/* روضة جنة الزهراء (ع) — الألوان مأخوذة من الشعار: الذهبي والأخضر الداكن
   التصميم يبدأ من الهاتف، ثم يتوسّع للشاشات الأكبر */
:root {
  --green: #14302A;
  --green-2: #1E4038;
  --green-3: #2E5A4F;
  --green-ink: #0D211C;
  --gold: #CDA45E;
  --gold-2: #E4CB94;
  --gold-ink: #8A672A;
  --sand: #EBE2CC;
  --paper: #F8F4EA;
  --cream: #FBF9F3;
  --ink: #1D2421;
  --muted: #646E69;
  --line: #E2DBCB;
  --mint: #F1EDE2;
  --maroon: #7A2530;
  --danger: #A33A2E;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(20, 48, 42, .10);
  --shadow-lg: 0 18px 50px rgba(13, 33, 28, .22);
  --head: 'Noto Kufi Arabic', 'Segoe UI', Tahoma, sans-serif;
  --body: 'Noto Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  --name: 'Amiri', 'Traditional Arabic', serif;
  --header-h: 60px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--body);
  font-size: 1rem;
  color: var(--ink);
  background: var(--cream);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.no-scroll { overflow: hidden; }
h1, h2, h3 { font-family: var(--head); line-height: 1.45; margin: 0 0 .5em; }
p { margin: 0 0 1em; }
a { color: var(--green-3); }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
code { font-family: Consolas, monospace; background: var(--mint); padding: .1em .45em; border-radius: 6px; font-size: .9em; direction: ltr; unicode-bidi: embed; }
[hidden] { display: none !important; }
.wrap { width: min(1180px, 100% - 2rem); margin-inline: auto; }
.narrow { max-width: 640px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- الأزرار ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  font: 700 .95rem var(--head);
  min-height: 48px; padding: .6em 1.4em; border-radius: 14px; border: 1.5px solid transparent;
  cursor: pointer; text-decoration: none; transition: transform .15s, background .2s, box-shadow .2s, border-color .2s;
}
.btn:active { transform: scale(.98); }
.btn-gold { background: var(--gold); color: var(--green-ink); }
.btn-gold:hover { background: var(--gold-2); box-shadow: 0 6px 18px rgba(205, 164, 94, .35); }
.btn-ghost { background: #fff; color: var(--green); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--green-3); }
.btn-ghost-light { background: rgba(255,255,255,.06); color: #fff; border-color: rgba(228,203,148,.45); }
.btn-ghost-light:hover { background: rgba(255,255,255,.12); }
.btn-danger { background: transparent; color: var(--danger); border-color: #E4C3BE; }
.btn-sm { min-height: 38px; padding: .35em 1em; font-size: .85rem; border-radius: 10px; }
.btn-block { width: 100%; }

/* ---------- الترويسة ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(13, 33, 28, .94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  color: #fff; border-bottom: 1px solid rgba(205,164,94,.18);
  padding-top: env(safe-area-inset-top);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: var(--header-h); }
.brand { display: flex; align-items: center; gap: .65rem; color: #fff; text-decoration: none; font: 700 1rem var(--head); }
.brand img { width: 34px; height: auto; }
.brand small { display: block; color: var(--gold-2); font: 500 .7rem var(--head); line-height: 1.2; }
.brand span { line-height: 1.25; }
.nav { display: none; }
.header-cta {
  display: inline-flex; align-items: center; gap: .4rem;
  color: var(--gold-2); text-decoration: none; font: 600 .88rem var(--head); background: transparent; cursor: pointer;
  border: 1px solid rgba(205,164,94,.45); border-radius: 12px; padding: .45rem .8rem; min-height: 40px;
}
.header-cta svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- البطل والبحث ---------- */
.hero {
  position: relative; color: #fff; text-align: center;
  padding: 1.4rem 0 1.8rem;
  background:
    radial-gradient(60% 45% at 50% 18%, rgba(205,164,94,.16), transparent 70%),
    repeating-linear-gradient(120deg, transparent 0 46px, rgba(205,164,94,.05) 46px 47.5px),
    repeating-linear-gradient(60deg, transparent 0 46px, rgba(205,164,94,.05) 46px 47.5px),
    linear-gradient(180deg, var(--green-ink), var(--green) 70%);
}
.hero::after { /* حافة ذهبية رفيعة */
  content: ''; position: absolute; left: 0; right: 0; inset-inline: 0; bottom: 0; height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: .55;
}
.hero-inner { max-width: 640px; position: relative; z-index: 2; }
.hero-emblem { width: 62px; height: auto; margin: 0 auto .7rem; filter: drop-shadow(0 6px 22px rgba(205,164,94,.25)); }
.hero-title { margin: 0 auto .2rem; max-width: 270px; }
.hero-title img { width: 100%; height: auto; }
.hero-sub { color: #CFDCD6; font-size: .95rem; margin-bottom: 1.1rem; }


.search { position: relative; text-align: right; }
.search-box {
  display: flex; align-items: center; gap: .3rem;
  background: #fff; border-radius: 16px; box-shadow: 0 16px 40px rgba(0,0,0,.28);
  padding: .25rem .9rem .25rem .4rem; border: 2px solid transparent; transition: border-color .2s;
}
.search-box:focus-within { border-color: var(--gold); }
.search-icon { width: 22px; height: 22px; fill: none; stroke: var(--gold-ink); stroke-width: 2.2; stroke-linecap: round; flex: none; }
.search-box input {
  flex: 1; border: 0; outline: 0; background: transparent; min-width: 0;
  font: 500 1.06rem var(--body); color: var(--ink); padding: .85rem .5rem; /* ≥16px كي لا يكبّر iOS الصفحة */
  -webkit-appearance: none; appearance: none; border-radius: 0;
}
.search-box input::placeholder { color: #8C948F; }
.search-box input::-webkit-search-cancel-button { display: none; }
.clear-btn { border: 0; background: var(--mint); color: var(--muted); width: 36px; height: 36px; border-radius: 50%; font-size: 1.3rem; cursor: pointer; line-height: 1; flex: none; }

.results {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 8px);
  list-style: none; margin: 0; padding: .35rem;
  background: #fff; color: var(--ink); border-radius: 16px; box-shadow: var(--shadow-lg);
  max-height: 380px; max-height: min(380px, 55vh); max-height: min(380px, 55svh); overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
}
.results li { padding: .7rem .9rem; border-radius: 12px; cursor: pointer; display: flex; flex-direction: column; line-height: 1.5; }
.results li:hover, .results li.active { background: var(--mint); }
.results li + li { border-top: 1px solid #F1EEE6; }
.r-name { font: 700 1.2rem var(--name); color: var(--green); }
.r-name mark { background: rgba(205,164,94,.32); color: inherit; border-radius: 4px; padding: 0 2px; }
.r-loc { color: var(--muted); font-size: .85rem; }
.r-plot .r-name { font: 700 1rem var(--head); }
.results .no-results { color: var(--muted); cursor: default; }
.hint { color: #A9BFB6; font-size: .85rem; margin: .8rem 0 0; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: 1.4rem 0 0; }
.stats div { display: flex; flex-direction: column-reverse; border-top: 1px solid rgba(205,164,94,.35); padding-top: .7rem; }
.stats dd { margin: 0; font: 800 1.6rem var(--head); color: var(--gold); line-height: 1.3; }
.stats dt { color: #BCCCC5; font-size: .8rem; line-height: 1.4; }

/* ---------- الأقسام ---------- */
.section { padding: 2.6rem 0; }
.section-tint { background: var(--paper); border-block: 1px solid var(--line); }
.section-head { text-align: center; max-width: 620px; margin: 0 auto 1.4rem; }
.kicker { color: var(--gold-ink); font: 700 .8rem var(--head); letter-spacing: .02em; margin-bottom: .2rem; }
.kicker::before, .kicker::after { content: '◆'; font-size: .55em; vertical-align: middle; margin-inline: .6em; color: var(--gold); }
.section-head h2 { font-size: clamp(1.4rem, 5.5vw, 2rem); color: var(--green); }
.section-head p:not(.kicker) { color: var(--muted); font-size: .95rem; }

/* ---------- الخريطة ---------- */
.map-section { padding-top: 2rem; }
.map-section .wrap { width: min(1180px, 100% - 1rem); }
.map-card { position: relative; }
.map-stage { position: relative; }
.map-viewport {
  position: relative; overflow: hidden;
  height: 560px; height: min(74vh, 660px); height: min(74svh, 660px); min-height: 420px;
  background:
    radial-gradient(circle at 1px 1px, rgba(20,48,42,.07) 1px, transparent 0) 0 0 / 18px 18px,
    #F4EEE0;
  border-radius: var(--radius); border: 1px solid var(--line);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.map-viewport.mini { height: 340px; min-height: 0; margin-top: 1rem; }
.map-svg { width: 100%; height: 100%; display: block; cursor: grab; outline: none; }
.map-svg:active { cursor: grabbing; }
.map-svg text { pointer-events: none; }

.map-ground rect { fill: var(--sand); }
.map-qibla path { fill: var(--green-3); }
.map-label { fill: var(--green-3); font: 700 64px var(--head); text-anchor: middle; dominant-baseline: middle; }
.map-entrance rect { fill: var(--green); }
.map-entrance-arrow { fill: none; stroke: var(--gold); stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; }
.map-entrance-label { fill: var(--gold-2); font: 700 46px var(--head); text-anchor: middle; }

.plot { cursor: pointer; }
.plot-box { stroke-width: 2; transition: fill .2s; }
.plot.has .plot-box { fill: var(--green-2); stroke: var(--green); }
.plot.empty .plot-box { fill: var(--cream); stroke: #D3C8AE; }
.plot.reserved .plot-box { fill: #EAD6D2; stroke: #C9A09B; }
.plot-num { font: 700 54px var(--head); text-anchor: middle; dominant-baseline: central; transition: opacity .25s; }
.plot.has .plot-num { fill: var(--gold); }
.plot.empty .plot-num { fill: #A99E83; }
.plot.reserved .plot-num { fill: #9A5A55; }
.plot:hover .plot-box { stroke: var(--gold); }

.plot-detail { opacity: 0; transition: opacity .25s; }
.show-names .plot-num { opacity: 0; }
.show-names .plot-detail { opacity: 1; }
.plot-tag { font: 700 19px var(--head); }
.plot.has .plot-tag { fill: var(--gold); }
.plot.empty .plot-tag { fill: #A99E83; }
.plot.reserved .plot-tag { fill: #9A5A55; }
.slot { fill: transparent; }
.plot.has .slot.taken { fill: rgba(255,255,255,.05); }
.slot-name { fill: #F3EBDA; font-family: var(--name); font-weight: 700; text-anchor: middle; dominant-baseline: central; }
.slot-empty { fill: #A99E83; font: 600 16px var(--head); text-anchor: middle; }
.plot.reserved .slot-empty { fill: #9A5A55; }

.plot.selected .plot-box { fill: var(--gold); stroke: var(--green-ink); stroke-width: 3; }
.plot.selected .plot-num, .plot.selected .plot-tag { fill: var(--green-ink); }
.plot.selected .slot-name { fill: var(--green-ink); }
.plot.selected .slot.selected { fill: var(--green); }
.plot.selected .slot.selected + .slot-name { fill: var(--gold-2); }
.pulse {
  fill: none; stroke: var(--gold); stroke-width: 6; pointer-events: none;
  transform-box: fill-box; transform-origin: center; animation: pulse 1.8s ease-out infinite;
}
@keyframes pulse { from { transform: scale(1); opacity: .9; } to { transform: scale(1.18, 1.4); opacity: 0; } }

/* إبراز الضريح المطلوب: تخفيف باقي الخريطة + دبّوس متحرّك + سهم عند الاسم */
.plot, .line-label { transition: opacity .35s; }
.has-sel .plot:not(.selected), .has-sel .line-label { opacity: .45; }
.pin { pointer-events: none; }
.pin-body { fill: var(--gold); stroke: var(--green-ink); stroke-width: 5; }
.pin-dot { fill: var(--green-ink); }
.pin-shadow { fill: rgba(13,33,28,.35); transform-box: fill-box; transform-origin: center; animation: pin-shadow 1.1s ease-in-out infinite; }
.pin-bob { animation: pin-bob 1.1s ease-in-out infinite; }
@keyframes pin-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-26px); } }
@keyframes pin-shadow { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.6); opacity: .5; } }
.slot-arrow { opacity: 0; transition: opacity .25s; pointer-events: none; }
.show-names .slot-arrow { opacity: 1; }
.slot-arrow path { fill: var(--maroon); stroke: #fff; stroke-width: 3; stroke-linejoin: round; }
.slot-arrow-in { animation: nudge .8s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateX(14px); } }
.map-controls .locate { background: var(--gold); border-color: var(--gold); color: var(--green-ink); }

.map-controls { position: absolute; top: 10px; left: 10px; z-index: 4; display: flex; flex-direction: column; gap: 6px; }
.map-controls button {
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(255,255,255,.94); color: var(--green); font: 600 1.4rem/1 var(--head);
  display: grid; place-items: center; cursor: pointer; box-shadow: 0 4px 14px rgba(20,48,42,.12);
}
.map-controls button:hover { border-color: var(--gold); }
.map-controls svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.map-controls .i-close, .is-full .map-controls .i-open { display: none; }
.is-full .map-controls .i-close { display: block; }
.map-hint {
  position: absolute; top: 12px; right: 50%; transform: translateX(50%); z-index: 3; margin: 0;
  background: rgba(13,33,28,.82); color: #fff; font-size: .8rem; padding: .3rem .9rem; border-radius: 999px;
  pointer-events: none; transition: opacity .4s; white-space: nowrap;
}
.map-hint.gone { opacity: 0; }

/* اللوحة: على الهاتف تطفو فوق أسفل الخريطة */
.map-sheet {
  position: absolute; z-index: 5; left: 8px; right: 8px; bottom: 8px;
  max-height: 60%; overflow: auto; overscroll-behavior: contain;
  background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg);
  padding: 1rem 1rem 1.1rem; border-top: 3px solid var(--gold);
  animation: sheet-in .3s ease-out;
}
.map-sheet[data-state="empty"] { display: none; }
@keyframes sheet-in { from { transform: translateY(16px); opacity: 0; } }
.sheet-close {
  position: sticky; top: 0; float: left; margin: -.3rem -.3rem 0 0;
  width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--mint); color: var(--muted);
  font-size: 1.4rem; line-height: 1; cursor: pointer;
}
.sheet-kicker { color: var(--gold-ink); font: 700 .78rem var(--head); margin: 0; }
.sheet-name { font: 700 1.65rem/1.45 var(--name); color: var(--green); margin: .1rem 0 .7rem; }
.sheet-title { font-size: 1.15rem; color: var(--green); margin: .1rem 0 .6rem; }
.sheet-note { color: var(--muted); font-size: .85rem; margin: .7rem 0 0; }
.sheet-actions { display: flex; gap: .5rem; margin-top: .9rem; }
.sheet-actions .btn { flex: 1; padding-inline: .8rem; }
.sheet-empty { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }
.sheet-empty img { width: 54px; margin: 0 auto 1rem; opacity: .85; }
.sheet-empty h3 { color: var(--green); font-size: 1.05rem; }

.chips { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.chips span { background: var(--mint); border-radius: 14px; padding: .5rem .8rem; display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.chips small { color: var(--muted); font-size: .82rem; }
.chips b { font: 800 1.5rem var(--head); color: var(--green); line-height: 1.3; }

.directions-box { margin-top: .8rem; border: 1px solid var(--line); border-radius: 14px; padding: .2rem .9rem; }
.directions-box summary { cursor: pointer; font: 700 .9rem var(--head); color: var(--green); padding: .55rem 0; list-style-position: inside; }
.directions { list-style: none; padding: 0; margin: .4rem 0 .6rem; counter-reset: step; color: #39423D; font-size: .93rem; }
.directions li { counter-increment: step; position: relative; padding-inline-start: 2.5rem; padding-bottom: .8rem; min-height: 2.2rem; line-height: 1.65; }
.directions li::before {
  content: counter(step); position: absolute; inset-inline-start: 0; top: 0;
  width: 1.8rem; height: 1.8rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--lc, var(--green)); color: #fff; font: 700 .82rem var(--head);
  box-shadow: 0 0 0 3px #fff, 0 0 0 4px var(--lc, var(--green));
}
.directions li:not(:last-child)::after {
  content: ''; position: absolute; inset-inline-start: calc(.9rem - 1px); top: 2.1rem; bottom: .25rem;
  width: 2px; background: repeating-linear-gradient(to bottom, var(--lc, var(--green)) 0 4px, transparent 4px 8px); opacity: .5;
}
.directions li:last-child { padding-bottom: 0; font-weight: 600; color: var(--ink); }

.plot-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.plot-list button, .plot-list a {
  width: 100%; display: flex; align-items: center; gap: .75rem; text-align: right;
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
  padding: .55rem .8rem; min-height: 54px; cursor: pointer; text-decoration: none; color: inherit;
}
.plot-list button:hover, .plot-list a:hover { border-color: var(--gold); }
.slot-no {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--green); color: var(--gold-2); font: 700 .85rem var(--head);
}
.slot-text { flex: 1; font: 700 1.2rem/1.4 var(--name); color: var(--green); }
.chev { color: var(--gold-ink); font-size: 1.4rem; line-height: 1; }

.map-legend { display: flex; gap: .4rem 1rem; flex-wrap: wrap; justify-content: center; padding: .9rem .5rem 0; font-size: .82rem; color: var(--muted); }
.lg { display: inline-block; width: 16px; height: 11px; border-radius: 3px; margin-inline-end: .35rem; vertical-align: middle; }
.lg-filled { background: var(--green-2); }
.lg-empty { background: var(--cream); border: 1px solid #D3C8AE; }
.lg-reserved { background: #EAD6D2; border: 1px solid #C9A09B; }
.lg-selected { background: var(--gold); }

/* ملء الشاشة على الهاتف */
.map-card.is-full {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 100; background: var(--cream);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.is-full .map-stage { height: 100%; }
.is-full .map-viewport { height: 100%; border-radius: 0; border: 0; }
.is-full .map-legend { display: none; }

/* ---------- دليل الزيارة ---------- */
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: .8rem; }
.steps li { display: flex; gap: 1rem; align-items: flex-start; background: #fff; border-radius: var(--radius); padding: 1.1rem 1.1rem; border: 1px solid var(--line); }
.steps b {
  flex: none; display: grid; place-items: center; width: 42px; height: 42px;
  border-radius: 50%; background: var(--green); color: var(--gold); font: 800 1.1rem var(--head);
}
.steps h3 { font-size: 1.02rem; color: var(--green); margin-bottom: .15rem; }
.steps p { color: var(--muted); font-size: .92rem; margin: 0; }

/* ---------- اليوم ---------- */
.today-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .8rem; }
.today-card { display: block; padding: 1rem 1.1rem; background: #fff; border: 1px solid var(--line); border-right: 4px solid var(--gold); border-radius: 14px; text-decoration: none; color: inherit; }
.today-card strong { display: block; font: 700 1.25rem var(--name); color: var(--green); }
.today-card span { color: var(--muted); font-size: .85rem; }

/* ---------- سجلّ الأسماء ---------- */
.roll { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.roll summary {
  cursor: pointer; padding: 1rem 1.2rem; font: 700 1rem var(--head); color: var(--green);
  display: flex; justify-content: space-between; align-items: center; list-style: none;
}
.roll summary::-webkit-details-marker { display: none; }
.roll summary::after { content: '⌄'; color: var(--gold-ink); font-size: 1.3rem; line-height: 1; transition: transform .2s; }
.roll[open] summary::after { transform: rotate(180deg); }
.roll summary span { color: var(--muted); font-weight: 500; margin-inline-start: .3rem; margin-inline-end: auto; }
.roll-list { padding: 0 1rem 1rem; display: grid; gap: 1.2rem; }
.roll-line { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .5rem .8rem; }
.roll-line h3 {
  grid-column: 1 / -1; display: flex; align-items: center; gap: .5rem; margin: 0;
  font-size: 1rem; color: var(--lc); border-bottom: 2px solid var(--lc); padding-bottom: .3rem;
}
.roll-line h3 i { width: 12px; height: 12px; border-radius: 50%; background: var(--lc); }
.roll-plot { display: flex; gap: .7rem; align-items: flex-start; border-top: 1px solid var(--mint); padding-top: .6rem; }
.roll-n {
  flex: none; min-width: 40px; height: 32px; border-radius: 10px; border: 0; cursor: pointer;
  background: var(--green); color: var(--gold-2); font: 700 .85rem var(--head);
}
.roll-plot ul { list-style: none; margin: 0; padding: 0; }
.roll-plot li button {
  border: 0; background: none; padding: .1rem 0; cursor: pointer; text-align: right;
  font: 700 1.08rem/1.6 var(--name); color: var(--ink);
}
.roll-plot li button:hover { color: var(--gold-ink); }

/* ---------- صفحة الشهيد ---------- */
.profile-hero {
  color: #fff; text-align: center; padding: 2.2rem 0 2.4rem; position: relative;
  background:
    radial-gradient(55% 40% at 50% 20%, rgba(205,164,94,.15), transparent 70%),
    repeating-linear-gradient(120deg, transparent 0 46px, rgba(205,164,94,.05) 46px 47.5px),
    repeating-linear-gradient(60deg, transparent 0 46px, rgba(205,164,94,.05) 46px 47.5px),
    linear-gradient(180deg, var(--green-ink), var(--green));
}
.profile-hero-inner { max-width: 620px; }
.portrait {
  width: 136px; height: 170px; margin: 0 auto 1.2rem; overflow: hidden;
  border-radius: 70px 70px 16px 16px; /* شكل المحراب */
  border: 3px solid var(--gold); background: var(--green-2);
  display: grid; place-items: center; box-shadow: 0 0 0 6px rgba(205,164,94,.15);
}
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.portrait .portrait-emblem { width: 62%; height: auto; object-fit: contain; opacity: .9; }
.eyebrow { color: var(--gold-2); font: 600 .9rem var(--head); margin-bottom: .2rem; }
.profile-hero h1 { font: 700 clamp(2rem, 8vw, 2.9rem)/1.4 var(--name); margin-bottom: .4rem; }
.profile-meta { color: #C9D6D0; }
.chips-light { max-width: 320px; margin: .8rem auto 0; }
.chips-light span { background: rgba(255,255,255,.07); border: 1px solid rgba(205,164,94,.3); }
.chips-light small { color: #BCCCC5; }
.chips-light b { color: var(--gold); }
.fatiha { color: var(--gold-2); font: 400 1.1rem var(--name); margin: 1.1rem 0 0; }
.profile-actions { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: center; margin-top: 1.3rem; }
.profile-actions .btn { flex: 1 1 200px; max-width: 280px; }
.profile-grid { display: grid; gap: 1rem; }
.profile-main { display: grid; gap: 1rem; align-content: start; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem; }
.card h2 { font-size: 1.1rem; color: var(--green); }
.card > p:last-child { margin-bottom: 0; }
.card-soft { background: var(--paper); }
.card-soft p { color: var(--muted); }
blockquote { margin: 0; padding: 1rem 1.2rem; background: var(--paper); border-right: 3px solid var(--gold); border-radius: 12px; font: 1.15rem var(--name); }
blockquote p:last-child { margin: 0; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .6rem; }
.gallery img { aspect-ratio: 1; object-fit: cover; border-radius: 10px; }
.doc-link { display: flex; align-items: center; padding: .8rem; border-radius: 10px; background: var(--mint); font-size: .85rem; word-break: break-all; text-decoration: none; }
.notfound-emblem { width: 80px; margin: 0 auto 1rem; }

/* ---------- التذييل ---------- */
.site-footer { background: var(--green-ink); color: #A9BDB5; padding: 2.2rem 0 calc(2rem + env(safe-area-inset-bottom)); font-size: .9rem; text-align: center; }
.footer-inner { display: flex; flex-direction: column; align-items: center; gap: .8rem; }
.footer-inner img { width: 78px; height: auto; opacity: .9; }
.footer-inner p { margin: 0; max-width: 520px; }
.footer-meta { font-size: .8rem; color: #7F978E; }
.site-footer a { color: var(--gold-2); }

/* ---------- لوحة الإدارة ---------- */
.admin { background: var(--paper); }
.notice { background: #fff; border: 1px dashed var(--gold); border-radius: 12px; padding: .8rem 1rem; font-size: .9rem; color: #5D5A4E; }
.admin-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem; margin: 1.2rem 0; }
.admin-stats div { background: #fff; border-radius: var(--radius); padding: .9rem 1.1rem; border: 1px solid var(--line); }
.admin-stats strong { display: block; font: 800 1.7rem var(--head); color: var(--green); line-height: 1.3; }
.admin-stats span { color: var(--muted); font-size: .85rem; }
.tabs { display: flex; gap: .2rem; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 1.2rem; }
.tab { border: 0; background: none; font: 600 .92rem var(--head); color: var(--muted); padding: .7rem .9rem; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab.active { color: var(--green); border-bottom-color: var(--gold); }
.panel { display: grid; gap: 1.2rem; }
.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.toolbar input[type=search], .toolbar input[type=url], .toolbar input[type=number], .toolbar select,
.form-grid input, .form-grid select, .form-grid textarea {
  font: 1rem var(--body); padding: .6rem .9rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); min-height: 44px;
}
.toolbar input[type=search] { flex: 1; min-width: 180px; }
.toolbar input[type=number] { width: 120px; }
.toolbar input[type=url] { width: 100%; max-width: 520px; }
.check { display: inline-flex; gap: .4rem; align-items: center; font-size: .92rem; }
.table-wrap { overflow-x: auto; background: #fff; border-radius: var(--radius); border: 1px solid var(--line); }
.data-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.data-table th { background: var(--green); color: #fff; font: 600 .85rem var(--head); text-align: right; padding: .75rem .9rem; white-space: nowrap; }
.data-table td { padding: .6rem .9rem; border-top: 1px solid #EEF0EE; }
.data-table tbody tr:hover { background: var(--mint); }
.data-table a { color: var(--ink); text-decoration: none; font-weight: 600; }
.data-table a:hover { color: var(--green-3); text-decoration: underline; }
.tag { font-size: .78rem; padding: .15rem .6rem; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.tag-ok { background: #DDEEE4; color: #1F6B45; }
.tag-warn { background: #F6EBCF; color: #8A6A1F; }
.icon-btn { border: 1px solid var(--line); background: #fff; border-radius: 8px; width: 36px; height: 36px; cursor: pointer; color: var(--green); font-size: 1rem; }
.icon-btn:hover { border-color: var(--gold); }
.link-btn { border: 0; background: none; padding: 0; font: inherit; color: var(--green-3); cursor: pointer; text-decoration: underline; }
.ok { color: #1F6B45; font-weight: 600; }
.warn { color: #8A6A1F; }
.cols { columns: 3 220px; padding-inline-start: 1.2rem; }
.cols li { break-inside: avoid; }
.qr-list { list-style: none; padding: 0; margin: 0 0 1.4rem; display: grid; gap: .4rem; }
.qr-list li { display: grid; grid-template-columns: 1fr auto; gap: .3rem .8rem; align-items: center; background: var(--paper); padding: .5rem .8rem; border-radius: 10px; }
.qr-list li span { grid-column: 1 / -1; font-weight: 600; }
.qr-list code { background: none; overflow-wrap: anywhere; text-align: left; }
#qr-links h3 { font-size: 1rem; color: var(--green); }
#qr-links details { margin-bottom: 1.4rem; }
#qr-links summary { cursor: pointer; font-weight: 600; margin-bottom: .6rem; }

.editor { border: 0; border-radius: 20px; padding: 0; width: min(720px, 100% - 1.5rem); max-height: calc(100vh - 2rem); max-height: calc(100svh - 2rem); box-shadow: 0 30px 80px rgba(0,0,0,.3); }
.editor::backdrop { background: rgba(13,33,28,.55); }
.editor form { padding: 1.3rem; }
.editor h2 { color: var(--green); font-size: 1.2rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem; }
.form-grid label { display: flex; flex-direction: column; gap: .3rem; font-size: .88rem; font-weight: 600; color: #3C433E; }
.span-2 { grid-column: 1 / -1; }
.form-grid textarea { resize: vertical; }
.photo-row { display: flex; gap: .8rem; align-items: center; font-weight: 400; flex-wrap: wrap; }
.avatar {
  width: 56px; height: 56px; border-radius: 50%; flex: none; overflow: hidden;
  display: grid; place-items: center; background: var(--green); color: var(--gold);
  font: 700 1.1rem var(--head); border: 2px solid var(--gold);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.form-error { color: var(--danger); font-weight: 600; margin: 1rem 0 0; }
.dialog-actions { display: flex; gap: .6rem; margin-top: 1.4rem; }
.dialog-actions span { flex: 1; }

/* ---------- الخطوط والعنوان ---------- */
.line-label { cursor: pointer; }
.line-label rect { stroke: rgba(0,0,0,.15); stroke-width: 2; }
.line-label-k { fill: rgba(255,255,255,.85); font: 600 20px var(--head); text-anchor: middle; }
.line-label-n { fill: #fff; font: 800 38px var(--head); text-anchor: middle; }
.map-entrance-sub { fill: var(--green); font: 700 26px var(--head); text-anchor: middle; }

.line-bar {
  display: flex; gap: .4rem; overflow-x: auto; padding: .8rem .1rem .2rem; scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.line-bar::-webkit-scrollbar { display: none; }
.line-bar button {
  flex: none; display: inline-flex; align-items: center; gap: .4rem; scroll-snap-align: start;
  min-height: 40px; padding: .3rem .85rem; border-radius: 999px; cursor: pointer;
  background: #fff; border: 1.5px solid var(--line); font: 700 .88rem var(--head); color: var(--ink);
}
.line-bar button i { width: 12px; height: 12px; border-radius: 50%; background: var(--lc); }
.line-bar button.active { background: var(--lc); border-color: var(--lc); color: #fff; }
.line-bar button.active i { background: #fff; }
.line-bar button:not(.active):hover { border-color: var(--lc); }

.address { margin-bottom: .2rem; }
.address-line {
  display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  background: var(--lc); color: #fff; border-radius: 14px; padding: .55rem .9rem; margin-bottom: .5rem;
}
.address-line small { opacity: .85; font-size: .82rem; }
.address-line b { font: 800 1.08rem var(--head); }
.address-plot { color: var(--muted); font-size: .82rem; margin: .45rem 0 0; }
.chips-one { grid-template-columns: 1fr; }
.address-light { max-width: 360px; margin: .9rem auto 0; text-align: right; }
.address-light .chips span { background: rgba(255,255,255,.07); border: 1px solid rgba(205,164,94,.3); }
.address-light .chips small, .address-light .address-plot { color: #BCCCC5; }
.address-light .chips b { color: var(--gold); }
.address-light .address-plot { text-align: center; }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--lc); margin-inline-end: .4rem; vertical-align: middle; }
.results .r-note { cursor: default; color: var(--gold-ink); font: 700 .85rem var(--head); background: #FBF5E8; }
.roll-n { background: var(--lc) !important; color: #fff !important; }

.mic-btn {
  flex: none; width: 42px; height: 42px; border-radius: 12px; border: 0; cursor: pointer;
  background: var(--green); color: var(--gold-2); display: grid; place-items: center;
}
.mic-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.mic-btn.listening { background: var(--maroon); color: #fff; animation: listen 1.2s ease-in-out infinite; }
@keyframes listen { 50% { box-shadow: 0 0 0 8px rgba(122,37,48,.18); } }

/* ---------- وضع البحث على الهاتف ---------- */
.search-row { display: flex; align-items: center; gap: .5rem; }
.search-row .search-box { flex: 1; min-width: 0; }
.search-back, .search-tip { display: none; }
@media (max-width: 959px) {
  body.searching { overflow: hidden; }
  body.searching .search {
    position: fixed; z-index: 200; left: 0; right: 0;
    top: 0; top: var(--vvt, 0px);
    height: 100vh; height: var(--vvh, 100vh);
    display: flex; flex-direction: column;
    background: var(--green-ink);
    padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
    animation: search-in .18s ease-out;
  }
  body.searching .search-back {
    display: grid; place-items: center; flex: none; width: 44px; height: 44px;
    border: 0; border-radius: 12px; background: rgba(255,255,255,.08); color: var(--gold-2); cursor: pointer;
  }
  .search-back svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
  body.searching .search-box { box-shadow: none; }
  body.searching .results {
    position: static; flex: 0 1 auto; min-height: 0; max-height: none;
    margin-top: 10px; border-radius: 16px;
  }
  body.searching .results li { padding: .8rem .9rem; }
  body.searching .search-tip { display: block; color: #A9BFB6; font-size: .9rem; text-align: center; margin: 1.4rem 0 0; }
  body.searching .search-tip[hidden] { display: none; }
  body.searching .site-header { visibility: hidden; }
  body.searching .hero-inner { z-index: 300; } /* فوق أزرار الخريطة */
}
@keyframes search-in { from { opacity: 0; } }

/* على الهاتف: موقع الضريح أولًا في صفحة الشهيد */
.profile-grid .loc-card { order: -1; }
.loc-card .directions { margin-top: .2rem; }

/* ---------- الشاشات الأكبر ---------- */
@media (min-width: 640px) {
  .wrap { width: min(1180px, 100% - 3rem); }
  .hero { padding: 3rem 0; }
  .hero-emblem { width: 96px; }
  .hero-title { max-width: 400px; }
  .hero-sub { font-size: 1.08rem; }
  .stats dd { font-size: 2rem; }
  .stats dt { font-size: .88rem; }
  .section { padding: 3.6rem 0; }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .steps li { flex-direction: column; text-align: center; align-items: center; padding: 1.6rem 1.2rem; }
  .admin-stats { grid-template-columns: repeat(4, 1fr); }
  .form-grid { grid-template-columns: repeat(4, 1fr); }
  .qr-list li { grid-template-columns: 220px 1fr auto; }
  .qr-list li span { grid-column: auto; }
  .portrait { width: 160px; height: 200px; border-radius: 80px 80px 18px 18px; }
}

@media (min-width: 960px) {
  :root { --header-h: 70px; }
  .nav { display: flex; gap: .2rem; }
  .nav a { color: #E3EAE6; text-decoration: none; padding: .45rem .9rem; border-radius: 10px; font: 600 .92rem var(--head); }
  .nav a:hover { background: rgba(205,164,94,.12); color: var(--gold-2); }
  .header-cta { display: none; }
  .admin .header-cta { display: inline-flex; }
  .brand img { width: 40px; }

  .map-section .wrap { width: min(1180px, 100% - 3rem); }
  .map-stage { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1rem; }
  .map-viewport { height: 700px; }
  .map-sheet, .map-sheet[data-state="empty"] {
    display: block; position: static; max-height: 700px; animation: none;
    box-shadow: var(--shadow); border: 1px solid var(--line); border-top: 3px solid var(--gold); padding: 1.3rem;
  }
  .map-sheet[data-state="empty"] { display: grid; place-items: center; }
  .is-full .map-stage { grid-template-columns: minmax(0, 1fr) 380px; gap: 0; }
  .is-full .map-sheet { max-height: none; border-radius: 0; }

  .profile-grid { grid-template-columns: minmax(0, 1fr) 400px; gap: 1.5rem; align-items: start; }
  .profile-grid .loc-card { order: 0; }
  .loc-card { position: sticky; top: calc(var(--header-h) + 16px); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .pulse, .map-sheet, .pin-bob, .pin-shadow, .slot-arrow-in, .search { animation: none !important; }
}
