:root {
  --bg: #000;
  --panel: #0f0f10;
  --panel-2: #1a1a1c;
  --line: rgba(255, 255, 255, .08);
  --text: #f5f5f7;
  --muted: #8e8e93;
  --gold: #f8b604;
  --gold-ink: #000;
  --ok: #30d158;
  --bad: #ff453a;
  --blue: #0a84ff;
  --radius: 18px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 400 15px/1.55 'Plex Arabic', -apple-system, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3 { font-family: 'Alexandria', 'Plex Arabic', sans-serif; letter-spacing: -.2px; margin: 0; }

/* shell */
.nav {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px; padding: 12px 24px;
  background: rgba(0, 0, 0, .72); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font: 800 17px/1 'Alexandria', sans-serif; margin-left: 16px; white-space: nowrap; }
.brand img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px var(--gold); }
.nav .links { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.nav .links a { padding: 8px 14px; border-radius: 999px; color: var(--muted); white-space: nowrap; font-weight: 500; }
.nav .links a.on { background: var(--panel-2); color: var(--text); }
.nav .links a:hover { color: var(--text); }
main { max-width: 1240px; margin: 0 auto; padding: 28px 24px 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 34px; font-weight: 800; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

/* controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel-2); cursor: pointer; font-weight: 500; white-space: nowrap; transition: transform .1s, background .15s;
}
.btn:hover { background: #242427; }
.btn:active { transform: scale(.97); }
.btn.gold { background: var(--gold); color: var(--gold-ink); border-color: transparent; font-weight: 700; }
.btn.gold:hover { background: #ffc629; }
.btn.ok { color: var(--ok); }
.btn.bad { color: var(--bad); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.icon { width: 32px; padding: 0; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.input, textarea.input, select.input {
  width: 100%; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; outline: none;
}
textarea.input { resize: vertical; min-height: 80px; line-height: 1.6; }
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(248, 182, 4, .18); }
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.chip { padding: 7px 14px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; cursor: pointer; font-size: 14px; }
.chip.on { background: var(--text); color: #000; border-color: transparent; font-weight: 700; }
.chip .n { margin-inline-start: 6px; color: var(--gold); font-weight: 700; }
.chip.on .n { color: #000; }

/* cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 18px; margin-top: 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: transform .15s, border-color .15s; }
.card:hover { transform: translateY(-2px); border-color: rgba(248, 182, 4, .35); }
.card .thumb { aspect-ratio: 4 / 5; position: relative; overflow: hidden; background: #050505; }
.card .thumb .slide { position: absolute; top: 0; right: 0; transform-origin: top right; }
.card .reel-thumb { aspect-ratio: 4 / 5; padding: 22px; display: flex; flex-direction: column; justify-content: center; gap: 14px; background: radial-gradient(400px 300px at 80% 0, rgba(248,182,4,.18), transparent 60%), #050505; }
.card .reel-thumb .lbl { color: var(--gold); font-weight: 700; font-size: 13px; }
.card .reel-thumb .hook { font: 800 22px/1.4 'Alexandria', sans-serif; }
.card .meta { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.card .meta h3 { font-size: 15px; font-weight: 700; line-height: 1.45; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--panel-2); color: var(--muted); }
.tag.s-new { color: var(--blue); }
.tag.s-approved { color: var(--ok); }
.tag.s-posted { color: var(--gold); }
.tag.s-rejected { color: var(--bad); }

.empty { text-align: center; color: var(--muted); padding: 70px 20px; border: 1px dashed var(--line); border-radius: var(--radius); margin-top: 18px; }

/* idea detail */
.detail { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.panel + .panel { margin-top: 16px; }
.panel h3 { font-size: 16px; margin-bottom: 14px; }
.strip { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 10px; scroll-snap-type: x mandatory; }
.strip .cell { flex: none; scroll-snap-align: start; position: relative; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
.strip .cell .slide { transform-origin: top right; position: absolute; top: 0; right: 0; }
.strip .cell .dl { position: absolute; bottom: 8px; left: 8px; z-index: 5; opacity: 0; transition: opacity .15s; }
.strip .cell:hover .dl { opacity: 1; }
.sticky { position: sticky; top: 76px; }
.status-bar { display: flex; gap: 8px; flex-wrap: wrap; }
.status-bar .btn.on { outline: 2px solid currentColor; outline-offset: 1px; }
.caption { white-space: pre-wrap; background: var(--panel-2); border-radius: 12px; padding: 14px; font-size: 14px; line-height: 1.75; }
.sources a { color: var(--blue); word-break: break-all; }
.sources li { margin-bottom: 6px; }
.slide-ed { border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; background: #131315; }
.slide-ed .hd { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.slide-ed .hd b { color: var(--gold); font-family: 'Alexandria'; }
.hint { font-size: 12px; color: var(--muted); }

/* reel script */
.script { display: flex; flex-direction: column; gap: 12px; }
.beat { border-radius: 14px; background: var(--panel-2); padding: 14px 16px; border-right: 3px solid var(--line); }
.beat.hook { border-right-color: var(--gold); }
.beat.outro { border-right-color: var(--ok); }
.beat .lbl { font-size: 12px; color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.beat .say { font-size: 16px; line-height: 1.7; }
.beat .meta2 { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.beat .meta2 b { color: var(--text); font-weight: 500; }

/* lists */
.list { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.item { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start; }
.item .txt { flex: 1; white-space: pre-wrap; }
.item a { color: var(--blue); word-break: break-all; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-top: 18px; }
.media-grid .m { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.media-grid .m img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: #111; }
.media-grid .m .b { padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.drop { border: 1.5px dashed rgba(248, 182, 4, .5); border-radius: var(--radius); padding: 28px; text-align: center; color: var(--muted); cursor: pointer; }
.drop.over { background: rgba(248, 182, 4, .06); }

/* picker modal */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .7); display: grid; place-items: center; padding: 20px; }
.modal .box { background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 20px; width: min(760px, 100%); max-height: 85vh; overflow: auto; }

/* login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: #000; }
.login .hero { position: relative; background: url(/img/tarek-hero.jpg) 70% 30% / cover no-repeat; }
.login .hero::after { content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, #000 0%, rgba(0,0,0,.35) 30%, rgba(0,0,0,0) 60%), radial-gradient(600px 400px at 80% 100%, rgba(248,182,4,.22), transparent 70%); }
.login form { align-self: center; justify-self: center; width: min(360px, calc(100% - 32px)); display: flex; flex-direction: column; gap: 14px; text-align: center; padding: 40px 0; }
.login .avatar { width: 92px; height: 92px; border-radius: 50%; object-fit: cover; margin: 0 auto 6px; box-shadow: 0 0 0 3px #000, 0 0 0 5px var(--gold); }
.login h1 { font-size: 34px; font-weight: 900; }
.login p { color: var(--muted); margin: 0 0 10px; }
.login .by { color: var(--gold); font-size: 13px; direction: ltr; margin-top: 6px; }
@media (max-width: 800px) {
  .login { grid-template-columns: 1fr; grid-template-rows: 46vh auto; }
  .login .hero { background-position: 75% 25%; }
  .login .hero::after { background: linear-gradient(0deg, #000 0%, rgba(0,0,0,0) 55%); }
  .login form { padding: 0 0 40px; margin-top: -60px; position: relative; z-index: 2; }
}

#toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); opacity: 0; transition: .25s; z-index: 99;
  background: #f5f5f7; color: #000; padding: 10px 18px; border-radius: 999px; font-weight: 700; pointer-events: none; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--bad); color: #fff; }

@media (max-width: 900px) {
  .detail { grid-template-columns: 1fr; }
  .sticky { position: static; }
  main { padding: 20px 16px 60px; }
  .nav { padding: 10px 16px; }
  .page-head h1 { font-size: 26px; }
}
