/* Sajjel — dark studio console look. Mobile first. */
:root {
  --bg: #0d0f12;
  --panel: #15181d;
  --panel2: #1b1f26;
  --line: #2a2f36;
  --text: #e8eaed;
  --muted: #9aa0a6;
  --red: #ff4d42;
  --red-deep: #d63a31;
  --amber: #f5a524;
  --green: #3ddc84;
  --radius: 16px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Kufi Arabic", "Noto Sans Arabic", Tahoma, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
button { font: inherit; color: inherit; cursor: pointer; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--bg); z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand strong { font-size: 20px; letter-spacing: .2px; display: block; }
.tagline { color: var(--muted); font-size: 11px; display: block; max-width: 46vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ghostbtn {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 7px 14px; font-size: 14px;
}
.ghostbtn:hover { border-color: var(--red); }

main { width: 100%; max-width: 620px; margin: 0 auto; padding: 0 16px 24px; flex: 1; }

#hero { text-align: center; padding: 26px 6px 8px; }
#hero h1 { font-size: 26px; line-height: 1.25; margin: 0 0 10px; }
#hero p { color: var(--muted); font-size: 14.5px; line-height: 1.7; margin: 0 auto; max-width: 46ch; }

.notice {
  margin: 14px 0 0; padding: 12px 14px; border-radius: var(--radius);
  background: #2a1a18; border: 1px solid var(--red-deep); color: #ffb4ae; font-size: 14px; line-height: 1.6;
}

.tabs {
  display: flex; gap: 6px; margin: 20px 0 16px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px; padding: 5px;
}
.tab {
  flex: 1; background: none; border: none; border-radius: 9px; padding: 9px 4px;
  color: var(--muted); font-size: 14.5px; display: flex; align-items: center; justify-content: center; gap: 6px;
}
.tab.on { background: var(--panel2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.count {
  background: var(--red); color: #fff; font-size: 11px; min-width: 18px; height: 18px;
  border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px;
}

.pane { display: none; }
.pane.on { display: block; }

/* --- record pane --- */
.stage {
  position: relative; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); aspect-ratio: 16 / 10; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.stage video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.stagehint { text-align: center; color: var(--muted); padding: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.stagehint strong { color: var(--text); font-size: 16px; }
.countoverlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 96px; font-weight: 800; color: var(--amber); background: rgba(13,15,18,.55);
  font-variant-numeric: tabular-nums;
}
.onair {
  position: absolute; top: 10px; inset-inline-start: 10px; z-index: 2;
  display: flex; align-items: center; gap: 7px; background: rgba(13,15,18,.75);
  border: 1px solid var(--red-deep); border-radius: 999px; padding: 4px 12px;
  font-size: 13px; font-weight: 700; letter-spacing: 1px;
}
.onair i { width: 9px; height: 9px; border-radius: 50%; background: var(--red); animation: blink 1.2s infinite; }
.onair b { font-variant-numeric: tabular-nums; }
@keyframes blink { 0%, 55% { opacity: 1; } 56%, 100% { opacity: .25; } }

.timer {
  text-align: center; font-size: 54px; font-weight: 800; margin: 18px 0 2px;
  font-variant-numeric: tabular-nums; letter-spacing: 1px;
}
.timer.live { color: var(--red); text-shadow: 0 0 24px rgba(255,77,66,.35); }
.chip {
  width: fit-content; margin: 6px auto 0; padding: 4px 14px; border-radius: 999px;
  background: #2b2410; border: 1px solid var(--amber); color: var(--amber); font-size: 13px; font-weight: 600;
}
.status { text-align: center; color: var(--muted); min-height: 22px; font-size: 14px; margin-top: 6px; }
.status.err { color: #ffb4ae; }
.status.ok { color: var(--green); }

.controls { display: flex; align-items: center; justify-content: center; gap: 22px; margin: 18px 0 8px; min-height: 84px; }
.recbtn {
  width: 84px; height: 84px; border-radius: 50%; border: 4px solid var(--text);
  background: none; display: flex; align-items: center; justify-content: center; transition: transform .08s;
}
.recbtn i { width: 34px; height: 34px; border-radius: 50%; background: var(--red); transition: border-radius .15s, width .15s, height .15s; }
.recbtn:hover { transform: scale(1.04); }
.recbtn.recording { border-color: var(--red); animation: pulse 1.6s infinite; }
.recbtn.recording i { border-radius: 7px; width: 28px; height: 28px; }
.recbtn:disabled { opacity: .45; cursor: default; animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255,77,66,.45); } 70% { box-shadow: 0 0 0 16px rgba(255,77,66,0); } 100% { box-shadow: 0 0 0 0 rgba(255,77,66,0); } }
.roundbtn {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 10px 16px; font-size: 12.5px; color: var(--muted);
}
.roundbtn:hover { color: var(--text); border-color: var(--amber); }

.estline { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.estline bdi { unicode-bidi: isolate; direction: ltr; display: inline-block; }

/* --- library --- */
.storagerow { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.meter { flex: 1; height: 8px; background: var(--panel2); border-radius: 4px; overflow: hidden; border: 1px solid var(--line); }
.meter i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--amber), var(--red)); transition: width .3s; }
.storagetxt { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.storagetxt b { color: var(--text); }
.hint { color: var(--muted); font-size: 12.5px; line-height: 1.6; margin: 4px 0 14px; }

.liblist { display: flex; flex-direction: column; gap: 12px; }
.rec {
  display: flex; gap: 12px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px; align-items: center;
}
.rec .thumb {
  width: 96px; height: 60px; border-radius: 9px; background: #000 center/cover no-repeat;
  flex: none; display: flex; align-items: flex-end; justify-content: flex-end; border: 1px solid var(--line);
}
.rec .thumb .dur {
  background: rgba(0,0,0,.75); font-size: 10.5px; padding: 1px 6px; border-radius: 6px; margin: 3px;
  font-variant-numeric: tabular-nums;
}
.rec .meta { flex: 1; min-width: 0; }
.rec .name { font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec .sub { color: var(--muted); font-size: 12px; margin-top: 3px; }
.rec .sub bdi, .storagetxt b { unicode-bidi: isolate; direction: ltr; display: inline-block; }
.rec .actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.rec .actions button {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 8px;
  font-size: 12px; padding: 5px 10px; display: inline-flex; align-items: center; gap: 5px;
}
.rec .actions button.primary { background: var(--red); border-color: var(--red); color: #fff; font-weight: 600; }
.rec .actions button.danger:hover { border-color: var(--red); color: #ffb4ae; }
.empty { color: var(--muted); text-align: center; padding: 30px 10px; font-size: 14px; line-height: 1.7; }
.demo { margin-top: 18px; border-top: 1px dashed var(--line); padding-top: 12px; }
.demo summary { color: var(--muted); font-size: 13px; cursor: pointer; }
.demo .ghostbtn { margin-top: 6px; font-size: 13px; }

/* --- settings --- */
.setrow { margin-bottom: 18px; }
.setrow > div:first-child { margin-bottom: 8px; font-size: 14.5px; }
.segs { display: flex; gap: 6px; flex-wrap: wrap; }
.segs button {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; font-size: 13px; color: var(--muted);
}
.segs button.on { background: var(--panel2); color: var(--text); border-color: var(--red); }
.switchrow {
  display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer;
}
.switchrow input { display: none; }
.sw {
  width: 44px; height: 26px; border-radius: 13px; background: var(--panel2); border: 1px solid var(--line);
  position: relative; flex: none; transition: background .15s;
}
.sw::after {
  content: ''; position: absolute; top: 2px; inset-inline-start: 2px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s;
}
.switchrow input:checked + .sw { background: var(--red-deep); border-color: var(--red); }
.switchrow input:checked + .sw::after { transform: translateX(18px); background: #fff; }
[dir="rtl"] .switchrow input:checked + .sw::after { transform: translateX(-18px); }
.swtxt b { display: block; font-size: 14.5px; }
.swtxt small { color: var(--muted); font-size: 12px; line-height: 1.5; display: block; margin-top: 2px; }

footer { text-align: center; color: var(--muted); font-size: 12px; padding: 18px 16px 26px; border-top: 1px solid var(--line); }

dialog {
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 0; width: min(94vw, 640px);
}
dialog::backdrop { background: rgba(0,0,0,.7); }
.dlgbar { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--line); }
dialog video { width: 100%; max-height: 70vh; background: #000; display: block; }

@media (min-width: 560px) {
  #hero h1 { font-size: 32px; }
  .timer { font-size: 64px; }
}
