:root{
  --navy:#0a1f3c; --navy2:#0d2a52; --navy3:#123667;
  --gold:#c9a227; --gold2:#e8c547; --gold3:#8a6d1f;
  --white:#ffffff; --off:#f6f8fc; --ink:#13203a; --line:#d8c07a;
  --font-head:'Aref Ruqaa',serif; --font-body:'Tajawal',sans-serif; --font-poem:'Amiri',serif;
}
*{margin:0;padding:0;box-sizing:border-box}
html{scroll-behavior:smooth}
body{font-family:var(--font-body);background:var(--off);color:var(--ink);overflow-x:hidden}
::selection{background:var(--gold);color:var(--navy)}
img{max-width:100%;display:block}
a{text-decoration:none;color:inherit}
button{font-family:var(--font-body);border:none;background:none;cursor:pointer}

/* ===== NAV ===== */
.nav{position:fixed;top:0;right:0;left:0;z-index:100;display:flex;align-items:center;gap:18px;
  padding:14px 4vw;transition:.4s;background:rgba(10,31,60,.55);backdrop-filter:blur(12px)}
.nav.scrolled{background:rgba(8,24,48,.96);box-shadow:0 6px 24px rgba(0,0,0,.35);padding:9px 4vw}
.logo{display:flex;align-items:center;gap:10px;color:var(--gold2)}
.logo svg{width:38px;height:38px;filter:drop-shadow(0 0 6px rgba(232,197,71,.5))}
.logo b{font-family:var(--font-head);font-size:1.25rem;letter-spacing:.5px}
.nav .links{display:flex;gap:4px;margin-inline-start:auto;overflow-x:auto;scrollbar-width:none}
.nav .links::-webkit-scrollbar{display:none}
.nav .links a{color:#e8edf7;font-weight:500;font-size:.92rem;padding:8px 13px;border-radius:30px;white-space:nowrap;position:relative;transition:.3s}
.nav .links a:hover{color:var(--gold2);background:rgba(201,162,39,.12)}
.editToggle{
  flex-shrink:0;
  background:linear-gradient(135deg,var(--gold2),var(--gold));
  color:var(--navy);
  font-weight:800;
  font-size:.9rem;
  padding:8px 18px;
  border-radius:40px;
  border:1px solid rgba(232,197,71,.55);
  box-shadow:0 4px 14px rgba(201,162,39,.35);
  transition:.25s;
}
.editToggle:hover{transform:translateY(-1px);box-shadow:0 8px 18px rgba(201,162,39,.45)}
.editToggle.on{background:#fff;color:var(--navy);box-shadow:0 0 0 2px var(--gold2)}
.sheet.edit-gate-sheet{width:min(440px,100%)}
.edit-gate-sheet .ach-save[disabled]{opacity:.65;cursor:wait;transform:none}
body.edit-mode .tcard{box-shadow:0 16px 36px rgba(10,31,60,.13),0 0 0 7px rgba(201,162,39,.16)}

/* ===== HERO ===== */
.hero{position:relative;min-height:100vh;display:flex;align-items:center;justify-content:center;text-align:center;overflow:hidden;color:#fff}
.hero .bg{position:absolute;inset:0;background:url('https://image.qwenlm.ai/public_source/2743d0f0-1cad-4bca-955b-e2c0813434ab/1cc33b0f5-bdf8-496f-b537-b7a7b956c79a.png') center 62%/cover no-repeat;transform:scale(1.05);animation:heroZoom 18s ease-in-out infinite alternate}
@keyframes heroZoom{from{transform:scale(1.05)}to{transform:scale(1.16)}}
.hero .veil{position:absolute;inset:0;background:linear-gradient(180deg,rgba(8,22,44,.82) 0%,rgba(8,22,44,.55) 45%,rgba(8,22,44,.92) 100%)}
#dust{position:absolute;inset:0;pointer-events:none}
.hero .inner{position:relative;z-index:2;padding:120px 20px 80px;max-width:900px}
.hero .kicker{display:inline-flex;align-items:center;gap:10px;color:var(--gold2);font-weight:700;letter-spacing:2px;font-size:.95rem;border:1px solid rgba(232,197,71,.5);padding:8px 22px;border-radius:40px;background:rgba(10,31,60,.4);animation:fadeDown 1s .2s both}
.hero h1{font-family:var(--font-head);font-size:clamp(2.6rem,7vw,5.2rem);line-height:1.35;margin:26px 0 8px;animation:fadeDown 1s .45s both}
.hero h1 span{background:linear-gradient(120deg,#f7dd7a,#c9a227 55%,#f2d061);-webkit-background-clip:text;background-clip:text;color:transparent}
.hero .sub{font-family:var(--font-poem);font-size:clamp(1.1rem,2.6vw,1.6rem);color:#dbe6f7;animation:fadeDown 1s .7s both}
.hero .sub em{color:var(--gold2);font-style:normal}
.hero .cta{margin-top:38px;display:flex;gap:16px;justify-content:center;flex-wrap:wrap;animation:fadeDown 1s .95s both}
.btn{display:inline-flex;align-items:center;gap:9px;padding:14px 34px;border-radius:50px;font-weight:700;font-size:1rem;transition:.35s;position:relative;overflow:hidden}
.btn-ico{width:18px;height:18px;flex-shrink:0}
.btn.gold{background:linear-gradient(135deg,var(--gold2),var(--gold) 60%,var(--gold3));color:var(--navy);box-shadow:0 8px 26px rgba(201,162,39,.4)}
.btn.gold:hover{transform:translateY(-4px);box-shadow:0 14px 34px rgba(201,162,39,.55)}
.btn.ghost{border:2px solid rgba(232,197,71,.65);color:var(--gold2)}
.btn.ghost:hover{background:rgba(201,162,39,.15);transform:translateY(-4px)}
@keyframes fadeDown{from{opacity:0;transform:translateY(26px)}to{opacity:1;transform:none}}
.scrollHint{position:absolute;bottom:26px;left:50%;transform:translateX(-50%);z-index:2;color:var(--gold2);animation:bob 2s ease-in-out infinite}
@keyframes bob{0%,100%{transform:translate(-50%,0)}50%{transform:translate(-50%,10px)}}

/* ===== SECTIONS ===== */
section{padding:96px 4vw;position:relative}
.secHead{text-align:center;margin-bottom:56px}
.secHead .tag{color:var(--gold);font-weight:700;letter-spacing:3px;font-size:.85rem}
.secHead h2{font-family:var(--font-head);font-size:clamp(1.9rem,4.5vw,3rem);margin:10px 0 6px}
.secHead .orn{display:flex;align-items:center;justify-content:center;gap:14px;color:var(--gold)}
.secHead .orn::before,.secHead .orn::after{content:'';height:2px;width:70px;background:linear-gradient(90deg,transparent,var(--gold));border-radius:4px}
.secHead .orn::after{background:linear-gradient(90deg,var(--gold),transparent)}
.dark{background:var(--navy);color:#eaf0fa}
.dark .secHead h2{color:#fff}
.dark .secHead h2 span{color:var(--gold2)}
.light .secHead h2 span{color:var(--gold3)}

/* ===== TREE ===== */
#tree{background:var(--white);background-image:radial-gradient(rgba(201,162,39,.09) 1px,transparent 1px);background-size:26px 26px;padding-inline:1.5vw}
.treeBar{max-width:1200px;margin:0 auto 18px;display:flex;flex-wrap:wrap;gap:12px;align-items:center;justify-content:center}
.crumbs{display:flex;flex-wrap:wrap;align-items:center;gap:6px;background:#fff;border:1.5px solid var(--line);border-radius:40px;padding:8px 18px;box-shadow:0 4px 14px rgba(10,31,60,.08)}
.crumbs button{color:var(--navy3);font-weight:700;font-size:.9rem;padding:4px 8px;border-radius:20px;transition:.25s}
.crumbs button:hover{color:var(--gold3);background:rgba(201,162,39,.12)}
.crumbs .sep{color:var(--gold)}
.crumbs .cur{color:var(--gold3);font-weight:800;padding:4px 8px}
.crumbs .gap-crumb{color:var(--navy);background:linear-gradient(135deg,var(--gold2),var(--gold));font-weight:800;font-size:.78rem;padding:3px 12px;border-radius:20px}
.treeStage{width:100%;max-width:none;margin:0 auto;border:2px solid rgba(201,162,39,.55);border-radius:24px;background:#fff;box-shadow:0 18px 48px rgba(10,31,60,.12);overflow:hidden}
.treeToolbar{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px;padding:12px 16px;background:linear-gradient(180deg,#0a1f3c,#0d2a52);border-bottom:2px solid var(--gold)}
.zoomBtns{display:flex;align-items:center;gap:8px}
.zoomBtns button,.treeActions button{background:rgba(255,255,255,.08);color:var(--gold2);border:1px solid rgba(232,197,71,.45);border-radius:40px;font-weight:800;padding:8px 16px;transition:.25s}
.zoomBtns button{width:38px;height:38px;padding:0;font-size:1.25rem;display:flex;align-items:center;justify-content:center}
.zoomBtns #zoomReset{width:auto;padding:8px 14px;font-size:.82rem}
.zoomBtns button:hover,.treeActions button:hover{background:rgba(201,162,39,.22);transform:translateY(-1px)}
#zoomLbl{color:var(--gold2);font-weight:800;min-width:52px;text-align:center}
.treeActions{display:flex;flex-wrap:wrap;gap:8px}
.treeActions button{display:inline-flex;align-items:center;gap:8px}
.treeActions .btn-ico{width:16px;height:16px}
#rootBtn{background:linear-gradient(135deg,var(--gold2),var(--gold));color:var(--navy);border-color:transparent}
#rootBtn:hover{background:linear-gradient(135deg,var(--gold),var(--gold3));color:#fff}
#rootBtn.active,#overviewBtn.active{box-shadow:0 0 0 2px #fff,0 0 0 4px var(--gold)}
.treeViewport{position:relative;height:68vh;min-height:560px;max-height:88vh;overflow:hidden;cursor:grab;background:#fff;background-image:radial-gradient(rgba(201,162,39,.09) 1px,transparent 1px);background-size:26px 26px;user-select:none;touch-action:none}
.treeViewport.grabbing{cursor:grabbing}
.treeScrollY{
  position:absolute;z-index:6;
  top:12px;bottom:12px;left:8px;
  width:22px;
  display:flex;flex-direction:column;align-items:center;gap:6px;
  pointer-events:auto;
  user-select:none;
}
.treeScrollY.is-off{opacity:.38;pointer-events:none}
.treeScrollY-btn{
  flex-shrink:0;width:22px;height:22px;padding:0;
  border-radius:50%;
  background:linear-gradient(180deg,#123667,#0a1f3c);
  color:var(--gold2);
  border:1px solid rgba(232,197,71,.55);
  font-size:.58rem;line-height:1;
  display:flex;align-items:center;justify-content:center;
  box-shadow:0 4px 10px rgba(10,31,60,.18);
  transition:.2s;
}
.treeScrollY-btn:hover{background:linear-gradient(180deg,var(--gold2),var(--gold));color:var(--navy)}
.treeScrollY-track{
  flex:1;width:8px;position:relative;
  background:rgba(10,31,60,.1);
  border:1px solid rgba(201,162,39,.4);
  border-radius:20px;
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.35);
  cursor:pointer;
}
.treeScrollY-thumb{
  position:absolute;left:50%;top:0;
  width:14px;height:48px;margin-left:-7px;
  background:linear-gradient(180deg,var(--gold2),var(--gold) 55%,var(--gold3));
  border:1px solid rgba(255,255,255,.45);
  border-radius:20px;
  box-shadow:0 4px 12px rgba(201,162,39,.45);
  cursor:grab;touch-action:none;
}
.treeScrollY-thumb:active{cursor:grabbing}
.treeCanvas{position:absolute;top:0;left:0;padding:28px 40px 48px;transform-origin:0 0;will-change:transform;width:max-content}
.treeCanvas.switching{opacity:.35}
.branchInfo{text-align:center;color:var(--gold3);font-weight:700;margin-top:14px;font-size:.95rem}
.hintTree{text-align:center;color:#7c8aa5;font-size:.88rem;margin-top:10px;line-height:1.9;max-width:820px;margin-inline:auto}
.hintTree b{color:var(--gold3)}

.tree{position:relative;width:max-content;margin:0 auto}
.tree ul{display:flex;justify-content:center;align-items:flex-start;position:relative;list-style:none;padding:0;margin:0;gap:28px}
.tree li{display:flex;flex-direction:column;align-items:center;position:relative}
.tree li > ul{margin-top:76px}
.tree ul.ord-ltr{direction:ltr}
.tree-lines{position:absolute;top:0;left:0;overflow:visible;pointer-events:none;z-index:0}

.tcard{
  display:flex;flex-direction:column;align-items:center;
  background:
    radial-gradient(140px 90px at 50% 0%, rgba(232,197,71,.18), transparent 72%),
    linear-gradient(180deg,#fffef8 0%,#ffffff 46%,#f6f1e2 100%);
  border:1.5px solid rgba(201,162,39,.58);
  border-radius:26px;
  padding:30px 22px 16px;
  box-shadow:0 16px 36px rgba(10,31,60,.13),0 0 0 7px rgba(201,162,39,.08);
  transition:transform .35s,box-shadow .35s,border-color .35s;
  position:relative;z-index:1;cursor:pointer;
  min-width:232px;max-width:268px;
}
.tcard::after{
  content:'';position:absolute;inset:8px;border-radius:20px;
  border:1px solid rgba(201,162,39,.26);pointer-events:none;z-index:0;
}
.tcard > *{position:relative;z-index:1}
.tcard:hover{
  transform:translateY(-8px);
  border-color:var(--gold);
  box-shadow:0 22px 44px rgba(201,162,39,.28),0 0 0 8px rgba(201,162,39,.12);
}
.tcard .ph{
  width:148px;height:148px;
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;
  border-radius:50%;
  border:3px solid var(--gold);
  box-shadow:0 0 0 6px #fff,0 0 0 8px rgba(201,162,39,.5),0 12px 22px rgba(10,31,60,.14);
  background:linear-gradient(165deg,#fbf7ea,#eef3fb 72%);
  color:#8a9bb5;
}
.tcard .ph svg{width:46%;height:auto}
.tcard .ph i{font-style:normal;font-size:.72rem;color:#9aa7bd;font-weight:700;letter-spacing:.6px}
.tcard.founder{min-width:300px;max-width:340px;padding:34px 24px 18px}
.tcard.founder .ph{width:210px;height:210px;border-width:4px;box-shadow:0 0 0 7px #fff,0 0 0 10px rgba(201,162,39,.55),0 16px 28px rgba(10,31,60,.16)}
.tcard.focus{min-width:268px;max-width:304px}
.tcard.focus .ph{width:176px;height:176px}
.tcard.child .ph{width:148px;height:148px}
.tcard.anc{min-width:200px;max-width:228px;padding:22px 16px 14px}
.tcard.anc .ph{width:96px;height:96px}
.tname{font-weight:800;color:var(--navy);margin-top:16px;font-size:1.18rem;line-height:1.45;text-align:center;letter-spacing:.2px}
.tname::before{content:'◆';display:block;color:var(--gold);font-size:.5rem;margin-bottom:6px;opacity:.85;letter-spacing:0}
.tcard.founder .tname{font-family:var(--font-head);font-size:1.7rem;color:var(--gold3);margin-top:18px}
.tcard.anc .tname{font-size:1rem;margin-top:12px}
.tmeta{font-size:.78rem;color:#5d6c88;margin-top:3px;text-align:center}
.tcard .tbadge{position:absolute;top:-14px;right:50%;transform:translateX(50%);background:linear-gradient(135deg,var(--gold2),var(--gold));color:var(--navy);font-size:.74rem;font-weight:800;padding:5px 16px;border-radius:30px;white-space:nowrap;box-shadow:0 5px 12px rgba(201,162,39,.42);z-index:3}
.tdead{margin-top:6px;font-size:.7rem;font-weight:800;color:#8d99ad;background:#eef1f6;border:1px solid #d4dae6;padding:3px 12px;border-radius:20px}
.tkids{margin-top:8px;font-size:.8rem;font-weight:700;color:var(--gold3);background:rgba(201,162,39,.12);border:1px solid rgba(201,162,39,.4);padding:4px 14px;border-radius:20px}
.bio-btn{
  position:relative;z-index:2;
  margin-top:14px;width:100%;
  padding:10px 14px;border-radius:40px;
  font-weight:800;font-size:.82rem;letter-spacing:.2px;
  color:var(--navy);
  background:linear-gradient(135deg,var(--gold2),var(--gold) 58%,#b8922a);
  box-shadow:0 6px 16px rgba(201,162,39,.38);
  transition:transform .25s,box-shadow .25s;
}
.bio-btn:hover{transform:translateY(-2px);box-shadow:0 10px 22px rgba(201,162,39,.5)}
.tcard.dead .ph{filter:grayscale(.9);opacity:.85}
.tcard.female{border-color:rgba(184,120,150,.58);box-shadow:0 16px 36px rgba(90,30,50,.1),0 0 0 7px rgba(184,120,150,.08);background:radial-gradient(140px 90px at 50% 0%,rgba(201,138,168,.18),transparent 72%),linear-gradient(180deg,#fff8fb 0%,#ffffff 46%,#f8eef3 100%)}
.tcard.female::after{border-color:rgba(184,120,150,.28)}
.tcard.female .ph{background:linear-gradient(165deg,#fdf2f6,#f7eef8 72%);border-color:#c98aa8;color:#c98aa8;box-shadow:0 0 0 6px #fff,0 0 0 8px rgba(201,138,168,.5),0 12px 22px rgba(90,30,50,.12)}
.tcard.female .tname{color:#7a3d58}
.tcard.female .tkids{color:#7a3d58;background:rgba(184,120,150,.12);border-color:rgba(184,120,150,.4)}
.tcard.female .bio-btn{background:linear-gradient(135deg,#e8b4c8,#c98aa8);color:#4a1f32;box-shadow:0 6px 16px rgba(184,120,150,.35)}
.tcard.compact{min-width:196px;max-width:224px;padding:20px 16px 14px;border-radius:26px}
.tcard.compact .ph{width:88px;height:88px}
.tcard.compact .tname{font-size:1.02rem;margin-top:12px}
.tcard.compact .bio-btn{margin-top:10px;padding:8px 12px;font-size:.76rem}
.tcard.full-sm{min-width:176px;max-width:208px;padding:20px 14px 12px}
.tcard.full-sm .ph{width:96px;height:96px}
.tcard.full-sm .tname{font-size:.98rem;margin-top:12px}
.tcard.full-sm .bio-btn{margin-top:10px;padding:8px 10px;font-size:.74rem}

.gap-node{position:relative;z-index:1;width:92px;height:92px;border-radius:50%;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:0;background:linear-gradient(160deg,var(--gold2),var(--gold) 55%,var(--gold3));color:var(--navy);font-weight:800;font-size:1.28rem;border:3px solid #fff;box-shadow:0 0 0 3px var(--gold),0 10px 24px rgba(201,162,39,.45);transition:.3s;line-height:1.1}
.gap-node small{font-size:.58rem;font-weight:800;letter-spacing:.3px;opacity:.85}
.gap-node:hover{transform:scale(1.08);box-shadow:0 0 0 3px var(--gold),0 14px 30px rgba(201,162,39,.6)}

.bio-overlay{
  position:fixed;inset:0;z-index:300;
  display:flex;align-items:center;justify-content:center;
  padding:24px;
  background:rgba(6,16,34,.72);
  backdrop-filter:blur(12px);
  opacity:0;visibility:hidden;pointer-events:none;
  transition:opacity .35s,visibility .35s;
}
.bio-overlay.open{opacity:1;visibility:visible;pointer-events:auto}
.bio-modal{
  position:relative;width:min(520px,100%);
  max-height:min(90vh,820px);
  overflow:hidden;
  background:#0a1f3c url('bio-modal-bg.png') center/cover no-repeat;
  border:1px solid rgba(232,197,71,.55);
  border-radius:18px;
  box-shadow:0 32px 90px rgba(8,22,44,.6),0 0 0 8px rgba(201,162,39,.14),0 0 60px rgba(201,162,39,.18);
  text-align:center;
  transform:translateY(22px) scale(.96);
  transition:transform .35s;
}
.bio-overlay.open .bio-modal{transform:none}
.bio-modal-inner{
  position:relative;z-index:1;
  max-height:min(90vh,820px);
  overflow:auto;
  padding:78px 62px 68px;
}
.bio-modal-inner::before{
  content:'';position:absolute;inset:58px 48px;border-radius:12px;
  background:rgba(8,22,44,.28);
  pointer-events:none;z-index:0;
}
.bio-modal-inner > *{position:relative;z-index:1}
.bio-close{
  position:absolute;top:22px;left:22px;z-index:3;
  width:38px;height:38px;border-radius:50%;
  background:rgba(10,31,60,.45);color:var(--gold2);
  border:1px solid rgba(232,197,71,.55);
  font-size:1.35rem;font-weight:700;line-height:1;
  display:flex;align-items:center;justify-content:center;
  transition:.25s;
}
.bio-close:hover{background:var(--gold2);color:var(--navy)}
.bio-modal .ph{
  width:128px;height:128px;margin:0 auto 18px;
  display:flex;align-items:center;justify-content:center;
  border-radius:50%;border:3px solid var(--gold2);
  box-shadow:0 0 0 6px rgba(10,31,60,.55),0 0 0 8px rgba(232,197,71,.7),0 12px 28px rgba(0,0,0,.35);
  background:linear-gradient(165deg,#123667,#0a1f3c 72%);
  color:var(--gold2);
}
.bio-modal.female .ph{border-color:#e8b4c8;background:linear-gradient(165deg,#3a2240,#1a1024);color:#e8b4c8;box-shadow:0 0 0 6px rgba(10,31,60,.55),0 0 0 8px rgba(232,180,200,.55),0 12px 28px rgba(0,0,0,.35)}
.bio-modal .ph svg{width:48%;height:auto}
.bio-modal h3{font-family:var(--font-head);font-size:2rem;color:var(--gold2);line-height:1.4;margin-bottom:4px;text-shadow:0 2px 16px rgba(0,0,0,.45)}
.bio-modal.female h3{color:#f3c9d8}
.bio-role{color:#d4c48a;font-weight:700;font-size:.92rem;margin-bottom:14px}
.bio-divider{color:var(--gold2);margin:4px 0 16px;letter-spacing:8px}
.bio-text{font-family:var(--font-poem);color:#eef3fb;font-size:1.08rem;line-height:2.15;text-align:justify;text-align-last:center;text-shadow:0 1px 8px rgba(0,0,0,.35)}
.bio-overlay.editing .bio-modal{width:min(560px,100%)}
.bio-overlay.editing .bio-modal-inner{padding-bottom:40px}
.bio-edit-actions[hidden],
.bio-edit-panel[hidden],
.bio-edit-actions button[hidden]{display:none !important}
.bio-edit-actions{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:22px;
  padding-top:18px;
  border-top:1px solid rgba(232,197,71,.35);
}
.bio-edit-actions button{
  flex:1;
  min-width:96px;
  padding:10px 8px;
  border-radius:14px;
  font-weight:800;
  font-size:.86rem;
  color:var(--navy);
  background:linear-gradient(135deg,var(--gold2),var(--gold));
  border:1px solid rgba(255,255,255,.25);
  box-shadow:0 6px 14px rgba(0,0,0,.22);
  transition:.2s;
}
.bio-edit-actions button:hover{transform:translateY(-2px);box-shadow:0 10px 18px rgba(201,162,39,.4)}
.bio-edit-actions button[data-edit-act="del"]{
  background:linear-gradient(135deg,#f3c9c9,#c45c5c);
  color:#3a1010;
}
.bio-edit-panel{
  margin-top:14px;
  text-align:right;
  background:rgba(8,22,44,.45);
  border:1px solid rgba(232,197,71,.35);
  border-radius:14px;
  padding:16px 14px;
}
.bio-form label,.bio-form .bio-form-title{
  display:block;
  color:var(--gold2);
  font-weight:800;
  font-size:.9rem;
  margin-bottom:8px;
}
.bio-form input[type="text"],
.bio-form input[type="number"],
.bio-form textarea,
.bio-form select{
  width:100%;
  margin-bottom:10px;
  padding:10px 12px;
  border-radius:10px;
  border:1px solid rgba(232,197,71,.45);
  background:rgba(255,255,255,.96);
  color:var(--navy);
  font-family:var(--font-body);
  font-size:.92rem;
  font-weight:700;
}
.bio-form textarea{min-height:110px;resize:vertical;line-height:1.8;font-weight:500}
.bio-form .kid-row{
  display:grid;
  grid-template-columns:1fr 110px;
  gap:8px;
  margin-bottom:8px;
}
.bio-form .kid-row select{margin-bottom:0}
.bio-form .kid-row input{margin-bottom:0}
.bio-gender{
  display:flex;gap:10px;margin-bottom:12px;
}
.bio-gender label{
  flex:1;margin:0;padding:8px 6px;border-radius:12px;
  border:1px solid rgba(232,197,71,.4);
  background:rgba(255,255,255,.08);
  color:#eef3fb;
  font-size:.85rem;
  text-align:center;
  cursor:pointer;
}
.bio-gender input{accent-color:var(--gold)}
.bio-form .bio-form-actions{display:flex;gap:8px;margin-top:6px}
.bio-form .bio-form-actions button{
  flex:1;padding:10px 12px;border-radius:12px;
  font-weight:800;font-size:.88rem;
  background:linear-gradient(135deg,var(--gold2),var(--gold));
  color:var(--navy);
}
.bio-form .err{color:#ffb4b4;font-weight:700;font-size:.82rem;margin-bottom:8px}
.bio-photo-edit{display:flex;flex-direction:column;align-items:center;gap:10px;margin-bottom:16px}
.bio-photo-preview{
  width:108px;height:108px;padding:0;border-radius:50%;overflow:hidden;
  display:flex;align-items:center;justify-content:center;
  border:3px solid var(--gold2);
  background:linear-gradient(165deg,#123667,#0a1f3c 72%);
  color:var(--gold2);cursor:pointer;
  box-shadow:0 0 0 4px rgba(10,31,60,.45),0 0 0 6px rgba(232,197,71,.55);
}
.bio-photo-preview svg{width:46%;height:auto}
.bio-photo-preview img{width:100%;height:100%;object-fit:cover;display:block}
.bio-photo-preview.has-photo{padding:0;background:#0a1f3c}
.bio-photo-edit-btns{display:flex;flex-wrap:wrap;gap:8px;width:100%}
.bio-photo-edit-btns button{
  flex:1;min-width:120px;padding:9px 10px;border-radius:12px;
  font-weight:800;font-size:.82rem;
  background:rgba(255,255,255,.1);color:var(--gold2);
  border:1px solid rgba(232,197,71,.45);
}
.bio-photo-edit-btns button[data-photo-remove]{color:#ffd0d0;border-color:rgba(196,92,92,.55)}
.bio-photo-hint{margin:0;color:#d4c48a;font-size:.78rem;font-weight:700;text-align:center;line-height:1.7}
.tcard .ph.has-photo,.bio-modal .ph.has-photo{padding:0;overflow:hidden}
.tcard .ph.has-photo i,.bio-modal .ph.has-photo i{display:none}
.tcard .ph img,.bio-modal .ph img{
  width:100%;height:100%;object-fit:cover;object-position:center;
  display:block;border-radius:50%;
}
.bio-overlay.editing .bio-modal .ph{cursor:pointer}
.photo-crop-overlay{
  position:fixed;inset:0;z-index:420;
  display:flex;align-items:center;justify-content:center;
  padding:20px;
  background:rgba(4,10,22,.84);
  backdrop-filter:blur(10px);
  opacity:0;visibility:hidden;pointer-events:none;
  transition:opacity .28s,visibility .28s;
}
.photo-crop-overlay.open{opacity:1;visibility:visible;pointer-events:auto}
.photo-crop-sheet{
  width:min(440px,100%);
  max-height:min(92vh,820px);
  overflow:auto;
  background:#0a1f3c;
  border:1px solid rgba(232,197,71,.55);
  border-radius:18px;
  padding:22px 18px 18px;
  text-align:center;
  color:#eef3fb;
  box-shadow:0 28px 70px rgba(0,0,0,.5);
}
.photo-crop-sheet h3{font-family:var(--font-head);color:var(--gold2);font-size:1.45rem;margin-bottom:6px}
.photo-crop-sheet > p{color:#d4c48a;font-size:.82rem;font-weight:700;line-height:1.8;margin-bottom:4px}
.photo-crop-stage{
  position:relative;width:100%;aspect-ratio:1;
  overflow:hidden;border-radius:16px;background:#06101c;
  touch-action:none;cursor:grab;margin:14px 0 12px;
}
.photo-crop-stage.grabbing{cursor:grabbing}
.photo-crop-stage img{
  position:absolute;max-width:none;max-height:none;
  pointer-events:none;user-select:none;-webkit-user-drag:none;
}
.photo-crop-mask{
  position:absolute;left:50%;top:50%;width:72%;aspect-ratio:1;
  transform:translate(-50%,-50%);
  border-radius:50%;
  box-shadow:0 0 0 9999px rgba(0,0,0,.58);
  border:2px solid rgba(232,197,71,.95);
  pointer-events:none;z-index:2;
}
.photo-crop-zoom{display:flex;align-items:center;gap:10px;margin-bottom:12px}
.photo-crop-zoom span{color:var(--gold2);font-size:.75rem;font-weight:800;white-space:nowrap}
.photo-crop-zoom input{flex:1;accent-color:var(--gold)}
.photo-crop-actions{display:flex;gap:8px}
.photo-crop-actions button{
  flex:1;padding:11px 12px;border-radius:12px;font-weight:800;font-size:.9rem;
  border:1px solid rgba(232,197,71,.45);
  background:rgba(255,255,255,.08);color:var(--gold2);
}
.photo-crop-actions #photoCropOk{
  background:linear-gradient(135deg,var(--gold2),var(--gold));color:var(--navy);border-color:transparent;
}
.photo-crop-sheet .err{color:#ffb4b4;font-weight:700;font-size:.82rem;margin-bottom:8px}

@media(max-width:700px){
  .treeViewport{min-height:380px;max-height:78vh}
  .treeScrollY{width:26px;left:4px;top:8px;bottom:8px}
  .treeScrollY-btn{width:26px;height:26px}
  .treeScrollY-track{width:10px}
  .treeScrollY-thumb{width:16px;margin-left:-8px;min-height:44px}
  .treeToolbar{justify-content:center}
  .treeActions button{font-size:.82rem;padding:8px 12px}
  .tcard{min-width:200px;max-width:230px;padding:24px 16px 14px}
  .tcard .ph{width:124px;height:124px}
  .tcard.founder{min-width:240px;max-width:280px}
  .tcard.founder .ph{width:168px;height:168px}
  .bio-modal-inner{padding:64px 36px 56px}
  .bio-modal-inner::before{inset:48px 28px}
  .bio-modal h3{font-size:1.55rem}
  .bio-close{top:16px;left:16px}
  .editToggle{padding:7px 12px;font-size:.8rem}
  .bio-form .kid-row{grid-template-columns:1fr}
  .photo-crop-sheet{padding:16px 12px 14px}
  .photo-crop-sheet h3{font-size:1.2rem}
  .photo-crop-stage{margin:10px 0 8px}
  .sheet{padding:28px 18px 32px}
  .sheet-view:not(.ach-article){padding:42px 20px 36px}
  .ach-search{flex-direction:column}
}

/* ===== ACHIEVEMENTS ===== */
#achievements{
  background:
    radial-gradient(ellipse 80% 55% at 50% 18%, rgba(232,197,71,.16), transparent 58%),
    linear-gradient(180deg,var(--navy) 0%,var(--navy2) 100%);
}
.achToolbar{display:none;justify-content:center;margin:-10px auto 36px;max-width:1200px}
body.edit-mode #achievements:not(.is-empty) .achToolbar{display:flex}
.achAddBtn{
  display:inline-flex;align-items:center;gap:10px;
  background:linear-gradient(135deg,#f3dd7a,var(--gold2) 40%,var(--gold) 78%,var(--gold3));
  color:var(--navy);font-weight:800;font-size:1rem;
  padding:13px 28px;border-radius:40px;
  border:1px solid rgba(255,255,255,.28);
  box-shadow:0 10px 26px rgba(201,162,39,.38);
  transition:.25s;
}
.achAddBtn:hover{transform:translateY(-3px);box-shadow:0 16px 32px rgba(201,162,39,.52)}
.achEmpty[hidden],
.achGrid[hidden],
#achPickPane[hidden],
#achFormPane[hidden],
.poemEmpty[hidden],
.poemGrid[hidden],
#poemMetaPane[hidden],
#poemBodyPane[hidden],
#poemBaytEditor[hidden],
#poemFreeEditor[hidden]{display:none !important}
.achEmpty{max-width:720px;margin:0 auto}
.achEmpty-plate{
  position:relative;
  padding:56px 42px 48px;
  text-align:center;
  color:#cfd9ea;
  border-radius:28px;
  background:
    radial-gradient(circle at 50% 18%, rgba(232,197,71,.2), transparent 46%),
    linear-gradient(180deg, rgba(18,54,103,.72), rgba(8,22,44,.88));
  border:1px solid rgba(232,197,71,.55);
  box-shadow:0 28px 70px rgba(0,0,0,.35), 0 0 0 8px rgba(201,162,39,.08);
  overflow:hidden;
}
.achEmpty-plate::before{
  content:'';position:absolute;inset:14px;border-radius:18px;
  border:1px solid rgba(232,197,71,.28);pointer-events:none;
}
.achEmpty-corner{
  position:absolute;width:22px;height:22px;z-index:1;
  border-color:var(--gold2);border-style:solid;opacity:.85;
}
.achEmpty-corner.tl{top:18px;right:18px;border-width:2px 2px 0 0}
.achEmpty-corner.tr{top:18px;left:18px;border-width:2px 0 0 2px}
.achEmpty-corner.bl{bottom:18px;right:18px;border-width:0 2px 2px 0}
.achEmpty-corner.br{bottom:18px;left:18px;border-width:0 0 2px 2px}
.achEmpty-seal{
  width:108px;height:108px;margin:0 auto 18px;
  display:flex;align-items:center;justify-content:center;
  border-radius:50%;
  color:var(--gold2);
  background:radial-gradient(circle at 50% 40%, rgba(232,197,71,.22), rgba(10,31,60,.2) 72%);
  box-shadow:0 0 0 7px rgba(10,31,60,.35),0 0 0 8px rgba(232,197,71,.55),0 12px 28px rgba(0,0,0,.28);
}
.achEmpty-seal svg{width:78px;height:78px}
.achEmpty-plate h3{
  position:relative;z-index:1;
  font-family:var(--font-head);font-size:clamp(1.55rem,3.4vw,2.15rem);
  color:var(--gold2);line-height:1.6;margin:4px 0 10px;
  text-shadow:0 8px 24px rgba(0,0,0,.35);
}
.achEmpty-plate p{
  position:relative;z-index:1;
  font-family:var(--font-poem);font-size:1.08rem;line-height:2.05;
  color:#e4ebf7;max-width:34em;margin:0 auto 14px;
}
.achEmpty-hint{
  position:relative;z-index:1;display:block;
  color:#b7c3d8;font-size:.92rem;font-weight:700;
}
body.edit-mode .achEmpty-hint{display:none}
.achEmpty-cta{display:none;margin:22px auto 0;position:relative;z-index:1}
body.edit-mode .achEmpty-cta{display:inline-flex}
.achGrid{max-width:1200px;margin:0 auto;display:grid;grid-template-columns:repeat(auto-fill,minmax(270px,1fr));gap:24px}
.ach{
  background:
    radial-gradient(140px 90px at 50% 0%, rgba(232,197,71,.2), transparent 70%),
    linear-gradient(180deg, rgba(18,54,103,.78), rgba(8,24,48,.94));
  border:1px solid rgba(232,197,71,.48);
  border-radius:22px;padding:30px 22px 24px;transition:.4s;
  position:relative;overflow:hidden;cursor:pointer;text-align:center;
  box-shadow:0 16px 36px rgba(0,0,0,.22);
}
.ach::before{content:'';position:absolute;inset:10px;border-radius:14px;border:1px solid rgba(232,197,71,.22);pointer-events:none}
.ach:hover{transform:translateY(-8px);border-color:var(--gold2);box-shadow:0 22px 44px rgba(201,162,39,.22)}
.ach .ico{
  width:68px;height:68px;border-radius:50%;margin:0 auto 16px;
  display:flex;align-items:center;justify-content:center;
  background:radial-gradient(circle at 50% 36%, rgba(232,197,71,.28), rgba(10,31,60,.4) 72%);
  border:2px solid var(--gold2);color:var(--gold2);
  box-shadow:0 0 0 5px rgba(10,31,60,.45),0 8px 18px rgba(0,0,0,.28);
}
.ach .ico svg{width:40px;height:40px}
.ach .who{display:block;color:#e8c547;font-size:.88rem;font-weight:800;margin-bottom:8px;letter-spacing:.2px;line-height:1.7}
.ach h3{font-family:var(--font-head);color:var(--gold2);font-size:1.35rem;margin-bottom:10px;line-height:1.5}
.ach p{color:#d5deee;font-size:.92rem;line-height:1.9}
.ach .yr{display:inline-block;margin-top:16px;font-size:.78rem;font-weight:800;color:var(--navy);background:linear-gradient(135deg,var(--gold2),var(--gold));padding:5px 16px;border-radius:20px}
.ach-del{
  display:none;position:absolute;top:14px;left:14px;z-index:2;
  width:32px;height:32px;border-radius:50%;
  background:rgba(180,70,70,.92);color:#fff;font-size:1.15rem;line-height:1;
  border:1px solid rgba(255,255,255,.25);
}
body.edit-mode .ach-del{display:flex;align-items:center;justify-content:center}
.ach-del:hover{background:#c45c5c;transform:scale(1.08)}

.sheet-overlay{
  position:fixed;inset:0;z-index:320;
  display:flex;align-items:flex-start;justify-content:center;
  padding:88px 4vw 40px;
  background:rgba(6,16,34,.82);
  backdrop-filter:blur(14px);
  overflow:auto;
  opacity:0;visibility:hidden;pointer-events:none;
  transition:opacity .35s,visibility .35s;
}
.sheet-overlay.open{opacity:1;visibility:visible;pointer-events:auto}
.sheet{
  position:relative;width:min(920px,100%);
  margin:auto;
  background:linear-gradient(180deg,#123667,#0a1f3c);
  border:1px solid rgba(232,197,71,.5);
  border-radius:22px;
  padding:36px 32px 40px;
  box-shadow:0 32px 90px rgba(0,0,0,.5),0 0 0 8px rgba(201,162,39,.12);
  color:#eaf0fa;
}
.sheet-close{
  position:absolute;top:16px;left:16px;
  width:38px;height:38px;border-radius:50%;
  background:rgba(10,31,60,.45);color:var(--gold2);
  border:1px solid rgba(232,197,71,.55);
  font-size:1.35rem;font-weight:700;line-height:1;
  display:flex;align-items:center;justify-content:center;
}
.sheet-close:hover{background:var(--gold2);color:var(--navy)}
.sheet-head{text-align:center;margin-bottom:22px}
.sheet-head .tag{color:var(--gold2);font-weight:700;letter-spacing:2px;font-size:.82rem}
.sheet-head h2{font-family:var(--font-head);color:#fff;font-size:clamp(1.5rem,3vw,2.2rem);margin:8px 0 6px}
.sheet-head p{color:#cfd9ea;font-size:.95rem;line-height:1.8}
.sheet-head strong{color:var(--gold2)}
.sheet-back{
  display:inline-flex;margin-bottom:12px;
  color:var(--gold2);font-weight:800;font-size:.88rem;
  border:1px solid rgba(232,197,71,.45);border-radius:30px;padding:6px 14px;
}
.sheet-back:hover{background:rgba(201,162,39,.15)}
.ach-search{display:flex;gap:10px;margin-bottom:18px}
.ach-search input{
  flex:1;padding:12px 16px;border-radius:14px;
  border:1px solid rgba(232,197,71,.45);
  background:rgba(255,255,255,.96);color:var(--navy);
  font-family:var(--font-body);font-size:.95rem;font-weight:700;
}
.ach-search button{
  padding:12px 22px;border-radius:14px;font-weight:800;
  background:linear-gradient(135deg,var(--gold2),var(--gold));color:var(--navy);
}
.ach-people{
  display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:12px;
  max-height:min(58vh,560px);overflow:auto;padding:4px 2px 8px;
}
.ach-people::-webkit-scrollbar{width:8px}
.ach-people::-webkit-scrollbar-thumb{background:var(--gold);border-radius:8px}
.ach-person{
  display:flex;align-items:center;gap:12px;text-align:right;
  background:rgba(255,255,255,.06);border:1px solid rgba(201,162,39,.3);
  border-radius:16px;padding:12px 14px;color:#eaf0fa;transition:.25s;
}
.ach-person.on{
  border-color:var(--gold2);
  background:rgba(201,162,39,.2);
  box-shadow:0 0 0 2px rgba(232,197,71,.35);
}
.ach-person:hover,.ach-person:focus{
  border-color:var(--gold2);background:rgba(201,162,39,.14);transform:translateY(-2px);
}
.ach-person .ph{
  width:46px;height:46px;flex-shrink:0;border-radius:50%;
  display:flex;align-items:center;justify-content:center;
  border:2px solid var(--gold);color:var(--gold2);
  background:linear-gradient(165deg,#123667,#0a1f3c);
}
.ach-person .ph svg{width:58%;height:auto}
.ach-person.female .ph{border-color:#e8b4c8;color:#e8b4c8;background:linear-gradient(165deg,#3a2240,#1a1024)}
.ach-person .nm{display:block;font-weight:800;color:#fff;font-size:.9rem;line-height:1.7}
.ach-person .meta{display:block;color:#aebbd2;font-size:.78rem;margin-top:2px}
.ach-people-empty{grid-column:1/-1;text-align:center;color:#aebbd2;padding:28px 8px}
.ach-form{max-width:640px;margin:0 auto;text-align:right}
.ach-form label{display:block;color:var(--gold2);font-weight:800;margin:12px 0 7px}
.ach-form label small{display:block;color:#aebbd2;font-weight:600;font-size:.78rem;margin-top:3px}
.ach-form input,.ach-form textarea{
  width:100%;padding:12px 14px;border-radius:12px;
  border:1px solid rgba(232,197,71,.45);
  background:rgba(255,255,255,.96);color:var(--navy);
  font-family:var(--font-body);font-size:.95rem;font-weight:700;
}
.ach-form textarea{min-height:90px;resize:vertical;line-height:1.85;font-weight:500}
.ach-form textarea.tall{min-height:160px}
.ach-form .err{color:#ffb4b4;font-weight:700;font-size:.86rem;margin:10px 0 0}
.ach-save{
  width:100%;margin-top:18px;padding:14px;border-radius:14px;font-weight:800;font-size:1rem;
  background:linear-gradient(135deg,var(--gold2),var(--gold));color:var(--navy);
}
.ach-save:hover{transform:translateY(-2px)}
.sheet.sheet-view.ach-article{
  width:min(760px,100%);
  padding:0;
  overflow:hidden;
  background:#fff;
  text-align:center;
  border:0;
  box-shadow:0 32px 90px rgba(0,0,0,.5);
}
.ach-view-head{
  background:var(--navy);
  color:var(--gold2);
  padding:56px 40px 36px;
}
.ach-view-head h2{
  font-family:var(--font-head);
  color:var(--gold2);
  font-size:clamp(1.7rem,3.6vw,2.5rem);
  line-height:1.55;
  margin:0 0 12px;
}
.ach-view-who{
  color:var(--gold2);
  font-weight:800;
  font-size:1.02rem;
  line-height:1.8;
  margin:0 0 14px;
}
.ach-view-date{
  display:inline-block;
  margin:0;
  background:transparent;
  color:var(--gold2);
  border:1px solid rgba(232,197,71,.55);
  font-weight:800;font-size:.82rem;padding:5px 16px;border-radius:20px;
}
.ach-view-date[hidden]{display:none !important}
.ach-view-body{
  background:#fff;
  color:#111;
  padding:36px 42px 46px;
  text-align:right;
}
.ach-view-full{
  font-family:var(--font-poem);
  color:#111;
  font-size:1.18rem;
  line-height:2.25;
  text-align:justify;
  white-space:pre-wrap;
  margin:0;
}
.ach-article .sheet-close{
  background:rgba(255,255,255,.08);
  color:var(--gold2);
}

@media(max-width:700px){
  .achEmpty-plate{padding:42px 20px 36px}
  .ach-view-head{padding:48px 22px 28px}
  .ach-view-body{padding:26px 22px 34px}
  .hist-years{grid-template-columns:repeat(3,minmax(0,1fr))}
}

/* ===== POEMS ===== */
#poems{background:var(--navy);overflow:hidden;position:relative}
#poems::before{content:'';position:absolute;inset:0;background:url('https://image.qwenlm.ai/public_source/2743d0f0-1cad-4bca-955b-e2c0813434ab/1ee7e3d50-fbc4-4447-9485-b9c2efddb922.png') center 70%/cover no-repeat;opacity:.16}
#poems .veilP{position:absolute;inset:0;background:linear-gradient(180deg,rgba(10,31,60,.9),rgba(10,31,60,.75),rgba(10,31,60,.95))}
#poems .wrap{position:relative;z-index:2}
.poemToolbar{display:none;justify-content:center;margin:-10px auto 36px;max-width:1200px}
body.edit-mode #poems:not(.is-empty) .poemToolbar{display:flex}
.poemEmpty{max-width:720px;margin:0 auto}
.poemEmpty-plate{
  position:relative;
  padding:56px 42px 48px;
  text-align:center;
  color:#cfd9ea;
  border-radius:28px;
  background:
    radial-gradient(circle at 50% 18%, rgba(232,197,71,.2), transparent 46%),
    linear-gradient(180deg, rgba(18,54,103,.72), rgba(8,22,44,.88));
  border:1px solid rgba(232,197,71,.55);
  box-shadow:0 28px 70px rgba(0,0,0,.35), 0 0 0 8px rgba(201,162,39,.08);
  overflow:hidden;
}
.poemEmpty-plate::before{
  content:'';position:absolute;inset:14px;border-radius:18px;
  border:1px solid rgba(232,197,71,.28);pointer-events:none;
}
.poemEmpty-corner{
  position:absolute;width:22px;height:22px;z-index:1;
  border-color:var(--gold2);border-style:solid;opacity:.85;
}
.poemEmpty-corner.tr{top:18px;left:18px;border-width:2px 0 0 2px}
.poemEmpty-corner.bl{bottom:18px;right:18px;border-width:0 2px 2px 0}
.poemEmpty-corner.br{bottom:18px;left:18px;border-width:0 0 2px 2px}
.poemEmpty-seal{
  width:108px;height:108px;margin:0 auto 18px;
  display:flex;align-items:center;justify-content:center;
  border-radius:50%;
  overflow:hidden;
  color:var(--gold2);
  background:radial-gradient(circle at 50% 40%, rgba(232,197,71,.22), rgba(10,31,60,.2) 72%);
  box-shadow:0 0 0 7px rgba(10,31,60,.35),0 0 0 8px rgba(232,197,71,.55),0 12px 28px rgba(0,0,0,.28);
}
.poemEmpty-seal svg{width:76px;height:76px}
.poemEmpty-plate h3{
  position:relative;z-index:1;
  font-family:var(--font-head);font-size:clamp(1.55rem,3.4vw,2.15rem);
  color:var(--gold2);line-height:1.6;margin:4px 0 10px;
  text-shadow:0 8px 24px rgba(0,0,0,.35);
}
.poemEmpty-plate p{
  position:relative;z-index:1;
  font-family:var(--font-poem);font-size:1.08rem;line-height:2.05;
  color:#e4ebf7;max-width:34em;margin:0 auto 14px;
}
.poemEmpty-hint{
  position:relative;z-index:1;display:block;
  color:#b7c3d8;font-size:.92rem;font-weight:700;
}
body.edit-mode .poemEmpty-hint{display:none}
.poemEmpty-cta{display:none;margin:22px auto 0;position:relative;z-index:1}
body.edit-mode .poemEmpty-cta{display:inline-flex}
.poemGrid{max-width:1200px;margin:0 auto;display:grid;grid-template-columns:repeat(auto-fill,minmax(255px,1fr));gap:22px}
.poem{
  background:rgba(255,255,255,.045);border:1px solid rgba(201,162,39,.4);
  border-radius:18px;padding:28px 24px;text-align:center;transition:.4s;
  position:relative;backdrop-filter:blur(4px);cursor:pointer;
}
.poem::before,.poem::after{content:'❖';position:absolute;color:var(--gold);opacity:.7;font-size:.8rem;pointer-events:none}
.poem::before{top:10px;right:12px}
.poem::after{bottom:10px;left:12px}
.poem:hover{transform:translateY(-8px) rotate(-.5deg);background:rgba(201,162,39,.1);border-color:var(--gold2);box-shadow:0 18px 40px rgba(0,0,0,.4)}
.poem h3{font-family:var(--font-poem);font-weight:700;color:var(--gold2);font-size:1.35rem;margin-bottom:12px}
.poem .verse{
  font-family:var(--font-poem);color:#dfe8f6;font-size:.98rem;line-height:2;
  border-block:1px dashed rgba(201,162,39,.4);padding:10px 4px;margin-bottom:14px;
  white-space:pre-wrap;max-height:6.2em;overflow:hidden;
}
.poem .who{color:#aebbd2;font-size:.85rem;font-weight:700;display:flex;align-items:center;justify-content:center;gap:6px;margin:0}
.poem .quill{width:15px;height:15px;color:var(--gold2);flex-shrink:0}
.poem .when{display:block;width:fit-content;margin:12px auto 0;color:var(--navy);background:linear-gradient(135deg,var(--gold2),var(--gold));font-size:.75rem;font-weight:800;padding:4px 16px;border-radius:20px}
.poem-del{
  display:none;position:absolute;top:12px;left:12px;z-index:2;
  width:30px;height:30px;border-radius:50%;
  background:rgba(180,70,70,.92);color:#fff;font-size:1.1rem;line-height:1;
  border:1px solid rgba(255,255,255,.25);
}
body.edit-mode .poem-del{display:flex;align-items:center;justify-content:center}
.poem-del:hover{background:#c45c5c;transform:scale(1.08)}
.poem-people{max-height:min(32vh,280px);margin-bottom:8px}
.poem-picked{
  margin:0 0 10px;padding:10px 14px;border-radius:12px;
  background:rgba(201,162,39,.16);border:1px solid rgba(232,197,71,.45);
  color:var(--gold2);font-weight:800;text-align:center;
}
.poem-picked[hidden]{display:none !important}
.poem-mode{display:flex;gap:8px;justify-content:center;margin:0 auto 18px}
.poem-mode button{
  min-width:140px;padding:10px 16px;border-radius:14px;font-weight:800;
  border:1px solid rgba(232,197,71,.4);
  background:rgba(255,255,255,.08);color:#eaf0fa;
}
.poem-mode button.on{background:linear-gradient(135deg,var(--gold2),var(--gold));color:var(--navy);border-color:transparent}
.poem-editor-hint{text-align:center;color:#cfd9ea;font-size:.9rem;line-height:1.8;margin:0 0 14px}
.poem-bayt-list{display:flex;flex-direction:column;gap:12px;margin-bottom:14px}
.poem-bayt-row{
  position:relative;
  background:rgba(255,255,255,.05);
  border:1px solid rgba(232,197,71,.32);
  border-radius:16px;
  padding:14px 14px 12px;
}
.poem-bayt-fields{
  display:grid;grid-template-columns:1fr auto 1fr;gap:10px;align-items:center;
}
.poem-bayt-fields input{
  width:100%;padding:12px 14px;border-radius:12px;
  border:1px solid rgba(232,197,71,.45);
  background:rgba(255,255,255,.96);color:var(--navy);
  font-family:var(--font-poem);font-size:1.05rem;font-weight:700;text-align:center;
}
.poem-bayt-sep{color:var(--gold2);font-size:1.1rem;opacity:.85}
.poem-bayt-tools{display:flex;justify-content:flex-start;gap:6px;margin-top:8px}
.poem-bayt-tools button{
  width:32px;height:32px;border-radius:8px;font-weight:800;font-size:.95rem;
  border:1px solid rgba(232,197,71,.35);color:var(--gold2);
}
.poem-bayt-tools button:hover{background:rgba(201,162,39,.16)}
.poem-bayt-tools .poem-bayt-del-row{color:#ffb4b4;border-color:rgba(180,70,70,.5)}
.poem-add-bayt{
  display:flex;align-items:center;justify-content:center;width:100%;
  padding:12px;border-radius:14px;font-weight:800;
  border:1.5px dashed rgba(232,197,71,.55);color:var(--gold2);
  margin-bottom:8px;
}
.poem-add-bayt:hover{background:rgba(201,162,39,.12)}
.poem-free-text{
  width:100%;min-height:280px;padding:20px 18px;border-radius:16px;
  border:1px solid rgba(232,197,71,.45);
  background:rgba(255,255,255,.96);color:var(--navy);
  font-family:var(--font-poem);font-size:1.15rem;font-weight:500;
  line-height:2.15;text-align:center;white-space:pre-wrap;resize:vertical;
}
.poem-sheet .ach-save{margin-top:16px}
.sheet.sheet-view.poem-article{
  width:min(820px,100%);
  padding:0;
  overflow:hidden;
  background:#fff;
  text-align:center;
  border:0;
  box-shadow:0 32px 90px rgba(0,0,0,.5);
}
.poem-view-head{
  background:var(--navy);
  color:var(--gold2);
  padding:56px 40px 36px;
}
.poem-view-head h2{
  font-family:var(--font-head);
  color:var(--gold2);
  font-size:clamp(1.7rem,3.6vw,2.5rem);
  line-height:1.55;
  margin:0 0 12px;
}
.poem-view-who{
  color:var(--gold2);
  font-weight:800;
  font-size:1.02rem;
  line-height:1.8;
  margin:0 0 14px;
}
.poem-view-date{
  display:inline-block;
  margin:0 0 14px;
  background:transparent;
  color:var(--gold2);
  border:1px solid rgba(232,197,71,.55);
  font-weight:800;font-size:.82rem;padding:5px 16px;border-radius:20px;
}
.poem-view-date[hidden]{display:none !important}
.poem-view-notes{
  margin:8px auto 0;max-width:34em;
  color:#d7e0ef;font-size:.92rem;line-height:1.9;font-weight:600;
  white-space:pre-wrap;
}
.poem-view-notes::before{
  content:'ملاحظات';
  display:block;
  font-weight:800;
  font-size:.72rem;
  letter-spacing:1.5px;
  margin-bottom:4px;
  color:var(--gold2);
}
.poem-view-notes[hidden]{display:none !important}
.poem-view-body{
  background:#fff;
  color:#111;
  padding:36px 36px 50px;
}
.poem-view-bayts{display:flex;flex-direction:column;gap:10px}
.poem-view-bayt{
  display:grid;grid-template-columns:1fr auto 1fr;gap:14px;align-items:center;
  font-family:var(--font-poem);font-size:clamp(1.08rem,2.2vw,1.32rem);
  line-height:2.15;color:#111;
}
.poem-view-bayt .sadr,
.poem-view-bayt .ajuz{text-align:center}
.poem-view-bayt .sep{color:var(--gold3);opacity:.7;font-size:.95rem}
.poem-view-bayt.single{grid-template-columns:1fr}
.poem-view-free{
  font-family:var(--font-poem);
  font-size:clamp(1.12rem,2.2vw,1.32rem);
  line-height:2.25;
  white-space:pre-wrap;
  text-align:center;
  margin:0;
  color:#111;
}
.poem-article .sheet-close{
  background:rgba(255,255,255,.08);
  color:var(--gold2);
}

@media(max-width:700px){
  .poemEmpty-plate{padding:42px 20px 36px}
  .poem-view-head{padding:48px 22px 28px}
  .poem-view-body{padding:26px 18px 34px}
  .poem-bayt-fields,
  .poem-view-bayt{grid-template-columns:1fr}
  .poem-bayt-sep,
  .poem-view-bayt .sep{display:none}
}

/* ===== HISTORY ===== */
#history{background:var(--white)}
.diriyahStrip{max-width:1200px;margin:0 auto 70px;display:grid;grid-template-columns:1.1fr .9fr;gap:26px;align-items:stretch}
.diriyahStrip .imgBox{border-radius:22px;overflow:hidden;position:relative;min-height:340px;box-shadow:0 20px 50px rgba(10,31,60,.2)}
.diriyahStrip .imgBox img{width:100%;height:100%;object-fit:cover;position:absolute;inset:0;transition:transform 6s ease}
.diriyahStrip .imgBox:hover img{transform:scale(1.12)}
.diriyahStrip .txt{background:var(--navy);color:#dbe6f7;border-radius:22px;padding:34px 30px;position:relative;overflow:hidden}
.diriyahStrip .txt::after{content:'✦';position:absolute;left:-14px;bottom:-34px;font-size:9rem;color:rgba(201,162,39,.12)}
.diriyahStrip .txt h3{font-family:var(--font-head);color:var(--gold2);font-size:1.6rem;margin-bottom:14px}
.diriyahStrip .txt p{line-height:2;font-size:.95rem;margin-bottom:12px}
.diriyahStrip .txt .fact{display:flex;gap:10px;align-items:flex-start;margin-top:10px;font-size:.9rem}
.diriyahStrip .txt .fact b{color:var(--gold2)}
.diriyahStrip .txt .fact::before{content:'◆';color:var(--gold);font-size:.7rem;margin-top:5px}
.histToolbar{display:none;justify-content:center;margin:-18px auto 32px;max-width:980px}
body.edit-mode #history:not(.is-empty) .histToolbar{display:flex}
.histEmpty[hidden],
.histBoard[hidden],
#histStepTitle[hidden],
#histStepYear[hidden],
#histStepText[hidden],
#histBack[hidden]{display:none !important}
.histEmpty{max-width:640px;margin:0 auto}
.histEmpty-plate{
  text-align:center;
  padding:18px 18px 28px;
  color:var(--navy3);
}
.histEmpty-plate h3{font-family:var(--font-head);font-size:clamp(1.45rem,3vw,1.95rem);color:var(--navy);margin-bottom:8px}
.histEmpty-plate p{font-family:var(--font-poem);font-size:1.05rem;line-height:2;color:#5d6c88;margin-bottom:14px}
.histEmpty-hint{display:block;color:#7a879c;font-size:.92rem;font-weight:700}
body.edit-mode .histEmpty-hint{display:none}
.histAddBox{
  display:none;
  width:100%;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:6px;
  min-height:196px;
  margin:18px auto 0;
  padding:28px 20px;
  border-radius:22px;
  border:2px dashed var(--gold);
  background:linear-gradient(180deg,rgba(232,197,71,.12),rgba(201,162,39,.04));
  color:var(--navy);
  box-shadow:0 12px 32px rgba(10,31,60,.08);
  transition:.25s;
}
body.edit-mode .histEmpty .histAddBox{display:flex}
.histAddBox-inline{display:none;max-width:980px;min-height:140px;margin:8px auto 0}
body.edit-mode #history:not(.is-empty) .histAddBox-inline{display:flex}
.histAddBox:hover{transform:translateY(-4px);border-color:var(--gold2);background:linear-gradient(180deg,rgba(232,197,71,.2),rgba(201,162,39,.08));box-shadow:0 18px 40px rgba(201,162,39,.2)}
.histAddBox-plus{
  width:48px;height:48px;border-radius:50%;
  display:flex;align-items:center;justify-content:center;
  background:linear-gradient(135deg,var(--gold2),var(--gold));
  color:var(--navy);font-size:1.8rem;font-weight:800;line-height:1;
  margin-bottom:4px;
}
.histAddBox strong{font-size:1.05rem;font-weight:800}
.histAddBox small{color:#6b7890;font-size:.82rem;font-weight:600}
.histBoard{max-width:980px;margin:0 auto}
.tl{position:relative;padding:10px 0 8px}
.tl::before{
  content:'';position:absolute;
  top:8px;bottom:18px;right:50%;
  width:3px;margin-right:-1.5px;
  background:linear-gradient(180deg,transparent,var(--gold) 18px,var(--gold) calc(100% - 22px),transparent);
  border-radius:3px;
}
.tlItem{position:relative;width:50%;padding:0 44px 52px}
.tlItem:last-child{padding-bottom:28px}
.tlItem:nth-child(odd){margin-right:0;text-align:left}
.tlItem:nth-child(even){margin-right:50%;text-align:right}
.tlItem .dot{position:absolute;top:4px;right:auto;width:18px;height:18px;border-radius:50%;background:var(--gold);border:4px solid #fff;box-shadow:0 0 0 4px rgba(201,162,39,.25);z-index:2}
.tlItem:nth-child(odd) .dot{right:-9px}
.tlItem:nth-child(even) .dot{left:-9px;right:auto}
.tlItem .card{background:#fff;border:1.5px solid var(--line);border-radius:16px;padding:20px 22px;box-shadow:0 10px 26px rgba(10,31,60,.08);transition:.35s;display:inline-block;text-align:right;position:relative;max-width:100%}
.tlItem .card:hover{transform:translateY(-5px);border-color:var(--gold);box-shadow:0 16px 34px rgba(201,162,39,.2)}
body.edit-mode .tlItem .card{padding-left:42px}
.tlItem .date{display:inline-block;background:var(--navy);color:var(--gold2);font-weight:800;font-size:.8rem;padding:5px 16px;border-radius:20px;margin-bottom:10px}
.tlItem h4{color:var(--navy);font-size:1.02rem;margin-bottom:6px}
.tlItem p{color:#5d6c88;font-size:.88rem;line-height:1.8;white-space:pre-wrap}
.tl-del{
  display:none;position:absolute;top:10px;left:10px;z-index:2;
  width:28px;height:28px;border-radius:50%;
  background:rgba(180,70,70,.92);color:#fff;font-size:1.05rem;line-height:1;
  align-items:center;justify-content:center;
}
body.edit-mode .tl-del{display:flex}
.tl-del:hover{background:#c45c5c;transform:scale(1.08)}
.hist-stepper{display:flex;justify-content:center;gap:8px;margin:0 auto 22px;flex-wrap:wrap}
.hist-stepper span{
  min-width:92px;text-align:center;
  padding:7px 14px;border-radius:20px;
  border:1px solid rgba(232,197,71,.35);
  color:#aebbd2;font-size:.82rem;font-weight:800;
}
.hist-stepper span.on{background:linear-gradient(135deg,var(--gold2),var(--gold));color:var(--navy);border-color:transparent}
.hist-stepper span.done{color:var(--gold2);border-color:rgba(232,197,71,.7)}
.hist-cal{display:flex;gap:8px;margin-bottom:14px}
.hist-cal button{
  flex:1;padding:10px 12px;border-radius:12px;font-weight:800;
  border:1px solid rgba(232,197,71,.4);
  background:rgba(255,255,255,.08);color:#eaf0fa;
}
.hist-cal button.on{background:linear-gradient(135deg,var(--gold2),var(--gold));color:var(--navy);border-color:transparent}
.hist-decades{
  display:flex;gap:8px;overflow-x:auto;padding:4px 2px 12px;
  scrollbar-width:thin;
}
.hist-decades::-webkit-scrollbar{height:6px}
.hist-decades::-webkit-scrollbar-thumb{background:var(--gold);border-radius:8px}
.hist-decades button{
  flex:0 0 auto;padding:8px 14px;border-radius:20px;font-weight:800;font-size:.82rem;
  border:1px solid rgba(232,197,71,.35);
  background:rgba(255,255,255,.06);color:#dbe6f7;
}
.hist-decades button.on{background:var(--navy2);color:var(--gold2);border-color:var(--gold2)}
.hist-years{
  display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:8px;
}
.hist-years button{
  padding:11px 6px;border-radius:12px;font-weight:800;font-size:.88rem;
  border:1px solid rgba(232,197,71,.35);
  background:rgba(255,255,255,.95);color:var(--navy);
}
.hist-years button.on{background:linear-gradient(135deg,var(--gold2),var(--gold));color:var(--navy);border-color:transparent}
.hist-years button:hover{border-color:var(--gold2)}
.hist-year-preview{
  margin-top:14px;text-align:center;font-weight:800;color:var(--gold2);font-size:1.05rem;
}
.hist-form-actions{display:flex;gap:10px;margin-top:18px}
.hist-form-actions .ach-save{margin-top:0;flex:1}
.hist-back{
  flex:0 0 auto;padding:14px 22px;border-radius:14px;font-weight:800;
  border:1px solid rgba(232,197,71,.5);color:var(--gold2);
}
.hist-back:hover{background:rgba(201,162,39,.15)}

/* ===== REGISTRY ===== */
#registry{background:var(--white);background-image:radial-gradient(rgba(201,162,39,.09) 1px,transparent 1px);background-size:26px 26px}
.statGrid{max-width:1100px;margin:0 auto 54px;display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:22px}
.stat{background:var(--navy);border-radius:20px;padding:34px 20px;text-align:center;color:#fff;position:relative;overflow:hidden;box-shadow:0 16px 40px rgba(10,31,60,.25);transition:.35s}
.stat:hover{transform:translateY(-8px)}
.stat::before{content:'';position:absolute;inset:0;background:url('https://image.qwenlm.ai/public_source/2743d0f0-1cad-4bca-955b-e2c0813434ab/1b9e63634-a60e-405d-a54d-6cb87a4ea759.png') center/cover;opacity:.14}
.stat .num{position:relative;font-family:var(--font-head);font-size:3.2rem;color:var(--gold2);line-height:1.1;text-shadow:0 0 22px rgba(232,197,71,.4)}
.stat .lbl{position:relative;margin-top:8px;font-weight:700;color:#dbe6f7}
.stat .ico{position:relative;margin-bottom:8px;color:var(--gold2);display:flex;align-items:center;justify-content:center}
.stat .ico svg{width:30px;height:30px}
.genBox{max-width:860px;margin:0 auto;background:#fff;border:1.5px solid var(--line);border-radius:22px;padding:36px 34px;box-shadow:0 14px 40px rgba(10,31,60,.1)}
.genBox h3{font-family:var(--font-head);color:var(--navy);text-align:center;font-size:1.4rem;margin-bottom:26px}
.genRow{display:flex;align-items:center;gap:14px;margin-bottom:18px}
.genRow .g{min-width:180px;font-weight:800;color:var(--navy3);font-size:.92rem}
.genRow .bar{flex:1;height:14px;background:#eef1f6;border-radius:20px;overflow:hidden}
.genRow .fill{height:100%;width:0;border-radius:20px;background:linear-gradient(90deg,var(--gold3),var(--gold),var(--gold2));transition:width 1.4s cubic-bezier(.2,.7,.2,1)}
.genRow .n{min-width:34px;font-weight:800;color:var(--gold3)}
.motto{max-width:860px;margin:44px auto 0;text-align:center;font-family:var(--font-poem);font-size:clamp(1.15rem,2.6vw,1.6rem);color:var(--navy3);line-height:2.2}
.motto b{color:var(--gold3)}

/* ===== FOOTER ===== */
footer{background:var(--navy);color:#b9c6dc;text-align:center;padding:52px 4vw 34px;position:relative}
footer::before{content:'';position:absolute;top:0;right:0;left:0;height:3px;background:linear-gradient(90deg,transparent,var(--gold),transparent)}
footer .flogo{font-family:var(--font-head);color:var(--gold2);font-size:1.5rem;margin-bottom:10px}
footer p{font-size:.9rem;line-height:2}
footer .cr{margin-top:18px;font-size:.78rem;color:#7f8ea8}

#toTop{position:fixed;bottom:26px;left:26px;z-index:99;width:52px;height:52px;border-radius:50%;background:linear-gradient(135deg,var(--gold2),var(--gold));color:var(--navy);font-size:1.2rem;font-weight:800;box-shadow:0 10px 26px rgba(201,162,39,.45);opacity:0;pointer-events:none;transition:.35s}
#toTop.show{opacity:1;pointer-events:auto}
#toTop:hover{transform:translateY(-4px)}

.reveal{opacity:0;transform:translateY(30px);transition:opacity .9s ease,transform .9s ease}
.reveal.on{opacity:1;transform:none}

@media(max-width:900px){
  .diriyahStrip{grid-template-columns:1fr}
  .tl::before{right:14px;margin-right:0}
  .tlItem{width:100%;padding:0 44px 44px 0}
  .tlItem:nth-child(even){margin-right:0}
  .tlItem,.tlItem:nth-child(odd){text-align:right}
  .tlItem:nth-child(odd) .dot,.tlItem:nth-child(even) .dot{right:5px;left:auto}
  .hist-years{grid-template-columns:repeat(4,minmax(0,1fr))}
}
