/* موقع خالد المتجدد — ألوان خالد: برتقالي + سماوي */
:root{
  --orange:#f97316; --orange-d:#ea580c; --sky:#0ea5e9; --sky-l:#e0f2fe;
  --ink:#1e293b; --muted:#64748b; --line:#e2e8f0; --bg:#f8fafc; --card:#fff;
  --green:#16a34a; --radius:16px;
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{margin:0;font-family:"Segoe UI",Tahoma,Arial,sans-serif;background:var(--bg);color:var(--ink);line-height:1.7}
a{color:var(--sky);text-decoration:none}
img{max-width:100%;display:block}
button{font-family:inherit;cursor:pointer}
.dim{color:var(--muted);font-size:.9em}
.container{max-width:1080px;margin:0 auto;padding:0 14px 40px}
.topbar{position:sticky;top:0;z-index:20;background:#fff;border-bottom:2px solid var(--orange);display:flex;align-items:center;gap:16px;padding:10px 16px;flex-wrap:wrap}
.brand{font-size:1.25rem;color:var(--ink)}
.brand b{color:var(--orange)}
.topnav{display:flex;gap:4px;margin-inline-start:auto;flex-wrap:wrap}
.topnav a{padding:7px 12px;border-radius:999px;color:var(--ink);font-weight:600}
.topnav a.active,.topnav a:hover{background:var(--sky-l);color:var(--sky)}
.footer{border-top:1px solid var(--line);padding:18px 16px 30px;text-align:center;color:var(--muted);font-size:.92em}

/* hero */
.hero{background:linear-gradient(135deg,#fff7ed,#e0f2fe);border:1px solid var(--line);border-radius:var(--radius);padding:18px;margin:18px 0;display:grid;grid-template-columns:1fr;gap:14px}
@media(min-width:720px){.hero{grid-template-columns:1.2fr .8fr}}
.hero h1{margin:.1em 0;font-size:1.5rem;line-height:1.4}
.hero .kicker{display:inline-block;background:var(--orange);color:#fff;border-radius:999px;padding:2px 12px;font-size:.85em;font-weight:700}
.hero img{border-radius:12px;width:100%;aspect-ratio:960/340;object-fit:cover}
.btn{display:inline-block;border:0;border-radius:999px;padding:10px 20px;font-weight:700;font-size:1rem;background:var(--orange);color:#fff}
.btn:hover{background:var(--orange-d)}
.btn.ghost{background:#fff;color:var(--ink);border:1.5px solid var(--line)}
.btn.sky{background:var(--sky)}
.btn:disabled{opacity:.5;cursor:not-allowed}
.btnrow{display:flex;gap:8px;flex-wrap:wrap;margin:12px 0}

/* progress */
.progress{margin:18px 0;background:#fff;border:1px solid var(--line);border-radius:var(--radius);padding:14px 16px}
.progress .bar{height:12px;background:#e2e8f0;border-radius:999px;overflow:hidden;margin-top:8px}
.progress .bar i{display:block;height:100%;background:linear-gradient(90deg,var(--orange),var(--sky));width:0}

/* filters + grid */
.toolbar{position:sticky;top:57px;z-index:10;background:var(--bg);padding:10px 0;display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.search{flex:1;min-width:180px;padding:10px 14px;border:1.5px solid var(--line);border-radius:999px;font-size:1rem;font-family:inherit;background:#fff}
.chips{display:flex;gap:6px;flex-wrap:wrap}
.chip{border:1.5px solid var(--line);background:#fff;border-radius:999px;padding:6px 13px;font-size:.92em}
.chip.active{background:var(--ink);color:#fff;border-color:var(--ink)}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:14px;margin-top:14px}
.card{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);overflow:hidden;display:flex;flex-direction:column;content-visibility:auto;contain-intrinsic-size:auto 320px}
.card img{width:100%;aspect-ratio:16/9;object-fit:cover;object-position:top;background:#ddd}
.card .body{padding:12px 14px;display:flex;flex-direction:column;gap:6px;flex:1}
.card h3{margin:0;font-size:1.05rem;line-height:1.5}
.card .meta{font-size:.85em;color:var(--muted)}
.badge{display:inline-block;font-size:.78em;font-weight:700;border-radius:999px;padding:1px 9px;background:var(--sky-l);color:#0369a1}
.badge.done{background:#dcfce7;color:var(--green)}
.empty{padding:40px 10px;text-align:center;color:var(--muted)}

/* skeleton — هيكل تحميل بيظهر فوراً قبل وصول البيانات */
.skel{background:#e2e8f0;border-radius:8px;animation:skpulse 1.3s ease-in-out infinite}
@keyframes skpulse{50%{opacity:.55}}
.skel-line{height:16px;margin:10px 0}
.skel-line.big{height:30px}
.skel-line.short{width:60%}
.skel-img{aspect-ratio:16/9}
.skel-card{height:320px}

/* topic page */
.topic-head{margin:18px 0 8px}
.topic-head h1{font-size:1.6rem;line-height:1.4;margin:.2em 0}
.storyboard{border-radius:var(--radius);overflow:hidden;border:1px solid var(--line);cursor:zoom-in}
.storyboard img{width:100%;height:auto}
/* ستوري بورد: لوحة عريضة لكل مشهد (بدل الصورة الواحدة المضغوطة 960×340) —
   صورة المشهد الأصلية على جنب + العنوان والزمن والنص المنطوق وبطاقة الشرح */
.sb-boards{display:grid;gap:14px;margin:12px 0 4px}
.sb-board{display:grid;grid-template-columns:190px 1fr;background:#fff;border:1px solid var(--line);border-radius:var(--radius);overflow:hidden}
.sb-board img{width:100%;height:100%;aspect-ratio:9/16;object-fit:cover;object-position:top;cursor:zoom-in}
.sb-board-body{padding:14px 16px}
.sb-board-body h3{margin:0 0 4px;font-size:1.1rem}
.sb-board-body p{margin:6px 0;line-height:1.9}
.sb-board .explain{margin-top:10px;background:#fff7ed;border:1px solid #fdba74;border-radius:10px;padding:10px 12px;line-height:1.9}
@media(max-width:719px){.sb-board{grid-template-columns:120px 1fr}.sb-board-body{padding:10px 12px}}
/* بطاقة الشرح فوق صورة المعاينة في الاستوديو — بتتحدث مع كل مشهد */
.explain-card{background:#fff7ed;border:2px solid var(--orange);border-radius:var(--radius);padding:10px 14px;margin-bottom:10px;line-height:1.8}
.explain-card b{color:var(--orange-d)}
.explain-card .dim{font-size:.92em}
.script-box{background:#fff;border:1px solid var(--line);border-radius:var(--radius);padding:16px;margin-top:16px;white-space:pre-wrap;font-size:1.05rem;line-height:2}
.toggle{display:inline-flex;border:1.5px solid var(--line);border-radius:999px;overflow:hidden}
.toggle button{border:0;background:#fff;padding:8px 16px;font-weight:700}
.toggle button.active{background:var(--ink);color:#fff}
.src-list{list-style:none;padding:0;margin:10px 0;display:grid;gap:10px}
.src-list li{background:#fff;border:1px solid var(--line);border-radius:12px;padding:10px 14px}
.src-list .claim{font-weight:600}
.note{background:#fffbeb;border:1px solid #fde68a;border-radius:12px;padding:12px 14px;margin-top:14px}

/* lightbox */
.lightbox{position:fixed;inset:0;background:rgba(0,0,0,.92);z-index:50;display:flex;align-items:center;justify-content:center}
.lightbox[hidden]{display:none}
.lightbox img{max-height:88vh;max-width:94vw;border-radius:8px}
.lb-btn{position:absolute;background:rgba(255,255,255,.15);color:#fff;border:0;border-radius:50%;width:44px;height:44px;font-size:1.4rem}
.lb-close{top:14px;inset-inline-end:14px}
.lb-prev{inset-inline-start:10px;top:50%}
.lb-next{inset-inline-end:10px;top:50%}
.lb-cap{position:absolute;bottom:16px;left:0;right:0;text-align:center;color:#fff;font-weight:700}

/* sources page */
.src-row{background:#fff;border:1px solid var(--line);border-radius:12px;padding:12px 14px;margin-bottom:10px}
.src-row .claim{font-weight:700}
.src-row .who{color:var(--muted);font-size:.9em}

/* studio */
.studio-grid{display:grid;gap:16px}
@media(min-width:900px){.studio-grid{grid-template-columns:340px 1fr}}
.panel{background:#fff;border:1px solid var(--line);border-radius:var(--radius);padding:14px}
.panel h3{margin-top:0}
.field{margin-bottom:12px}
.field label{display:block;font-weight:700;margin-bottom:4px;font-size:.92em}
.field input[type=text],.field input[type=number],.field select,.field textarea{width:100%;padding:9px 11px;border:1.5px solid var(--line);border-radius:10px;font-family:inherit;font-size:1rem}
.field textarea{resize:vertical;min-height:56px}
.scn-edit{border:1px solid var(--line);border-radius:12px;padding:10px;margin-bottom:10px;display:grid;grid-template-columns:64px 1fr;gap:10px}
.scn-edit img{width:64px;border-radius:8px}
.scn-edit .row{display:flex;gap:6px}
.scn-edit .row input[type=number]{width:76px}
.preview-wrap{position:sticky;top:70px}
.preview{position:relative;width:min(100%,360px);margin:0 auto;aspect-ratio:9/16;background:#000;border-radius:14px;overflow:hidden}
.preview canvas{width:100%;height:100%;display:block}
.pbar{position:absolute;bottom:0;left:0;right:0;height:6px;background:rgba(255,255,255,.25)}
.pbar i{display:block;height:100%;background:var(--orange);width:0}
.ptime{position:absolute;top:8px;inset-inline-start:8px;background:rgba(0,0,0,.55);color:#fff;border-radius:999px;padding:2px 10px;font-size:.85em}
.rec-dot{display:inline-block;width:10px;height:10px;border-radius:50%;background:#dc2626;margin-inline-end:6px;animation:blink 1s infinite}
@keyframes blink{50%{opacity:.2}}
.warn{background:#fef2f2;border:1px solid #fecaca;border-radius:12px;padding:10px 14px;color:#991b1b}
.okbox{background:#f0fdf4;border:1px solid #bbf7d0;border-radius:12px;padding:10px 14px;color:#166534}

/* studio v2 — presets, timeline, audio, project */
.preset-btn.active{background:var(--ink);color:#fff;border-color:var(--ink)}
.tl-head{display:flex;gap:8px;align-items:baseline;flex-wrap:wrap;margin-bottom:10px}
.timeline{display:flex;gap:8px;overflow-x:auto;padding-bottom:4px}
.tl-block{flex:0 0 150px;background:var(--sky-l);border:2px solid transparent;border-radius:12px;padding:8px 10px;cursor:grab;user-select:none;display:flex;flex-direction:column;gap:2px}
.tl-block b{font-size:1rem}
.tl-block .tl-t{font-size:.85em;line-height:1.4;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tl-block .tl-d{font-size:.8em;color:var(--muted);font-weight:700}
.tl-block.selected{border-color:var(--orange);background:#fff7ed}
.tl-block.dragging{opacity:.45}
.tl-block.drop-hint{border-color:var(--sky);background:#e0f2fe}
.chk{display:flex;align-items:center;gap:6px;font-weight:600;margin:4px 0}
.slider-row{display:flex;align-items:center;gap:10px;margin:8px 0}
.slider-row span{flex:0 0 auto;font-size:.92em;font-weight:700}
.slider-row input[type=range]{flex:1;accent-color:var(--orange)}
.slider-row b{min-width:44px;text-align:center}
.row2{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.scn-edit.selected{border-color:var(--orange);box-shadow:0 0 0 2px #fed7aa}
.scn-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:6px}
.scn-head .mv{display:flex;gap:4px}
.scn-head .mv button{border:1.5px solid var(--line);background:#fff;border-radius:8px;width:28px;height:28px;line-height:1}
.scn-head .mv button:disabled{opacity:.35;cursor:not-allowed}
.img-rep{display:inline-flex;align-items:center;gap:4px;border:1.5px dashed var(--line);border-radius:10px;padding:6px 10px;cursor:pointer;font-weight:700;font-size:.9em;color:var(--sky)}
.img-rep:hover{border-color:var(--sky)}

/* gates + QC + hook + guide (من حزمة استوديو حصاد الداخلي v0.1) */
.qc-row{display:flex;gap:8px;align-items:baseline;padding:5px 0;border-bottom:1px dashed var(--line)}
.qc-row .st{font-weight:800;min-width:22px;text-align:center;flex:0 0 auto}
.qc-row .st.ok{color:var(--green)}
.qc-row .st.bad{color:#dc2626}
.qc-row .st.na{color:var(--muted)}
.hook-title{font-size:1.15rem;font-weight:800;line-height:1.5;background:#fff7ed;border:1px solid #fed7aa;border-radius:12px;padding:10px 14px;margin:8px 0}
.tips{margin:8px 0;padding-inline-start:20px}
.tips li{margin-bottom:4px}
.guide-pack{background:#fff;border:1px solid var(--line);border-radius:var(--radius);padding:14px 16px;margin-bottom:14px}
.guide-pack h2{margin-top:0}
.guide-pack ul{margin:8px 0;padding-inline-start:20px}
.guide-pack li{margin-bottom:4px}
.preset-desc{margin:4px 0 0}
.pipeline{display:flex;flex-wrap:wrap;gap:6px}
.pipe{border:1.5px solid var(--line);background:#fff;border-radius:999px;padding:4px 11px;font-size:.88em;font-weight:700}
.pipe.done{background:#dcfce7;border-color:#16a34a;color:#166534}
.pipe.current{background:#fff7ed;border-color:var(--orange);color:#9a3412}
.pipe.todo{opacity:.55}

/* صور البطاقات في الرئيسية: scene-1 عمودية 576×1024 */
.card img{aspect-ratio:9/16}
.hero img{aspect-ratio:9/16;max-width:280px;margin-inline-start:auto}
