:root {
  color-scheme: light dark;
  --bg: #f5f5ef;
  --card: #ffffff;
  --panel: #eaf0e6;
  --text: #17231e;
  --muted: #69786e;
  --line: #dbe4dc;
  --green: #116b53;
  --green-soft: #e1eee6;
  --deep: #173d32;
  --red: #b4483a;
  --amber: #a86a12;
  --shadow: 0 1px 2px rgba(23, 61, 50, .06), 0 4px 18px rgba(23, 61, 50, .06);
  --ug: "Noto Naskh Arabic", "Noto Sans Arabic", "SF Arabic", "Geeza Pro", "Segoe UI", Tahoma, "Arial", sans-serif;
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1513;
    --card: #161e1b;
    --panel: #1c2723;
    --text: #e6ece8;
    --muted: #93a39a;
    --line: #26332e;
    --green: #3dbe93;
    --green-soft: #183229;
    --deep: #cfe9dc;
    --red: #e0735f;
    --amber: #e0a94a;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--ui);
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.wrap { width: 100%; max-width: 860px; margin: 0 auto; padding: 0 20px; }
svg { flex: none; }

/* header */
.top { padding: 22px 0 6px; }
.top-inner { display: flex; align-items: center; gap: 16px; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo { width: 38px; height: 38px; }
.logo rect { fill: var(--green); }
.logo path { stroke: #fff; stroke-width: 2.4; stroke-linecap: round; fill: none; }
h1 { font-size: 19px; line-height: 1.2; margin: 0; letter-spacing: -.01em; }
.tagline { margin: 1px 0 0; color: var(--muted); font-size: 13px; }
.server {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card);
  color: var(--muted); font-size: 12.5px; white-space: nowrap; max-width: 52vw; overflow: hidden; text-overflow: ellipsis;
}
.server .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: none; }
.server.ok .dot { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.server.down .dot { background: var(--red); }
.server.wait .dot { animation: blink 1s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .25; } }

/* intro */
main { flex: 1; padding-bottom: 24px; }
.intro {
  margin-top: 26px; padding: 30px 28px 28px;
  background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow);
}
.ug-hello { font-family: var(--ug); font-size: 25px; line-height: 1.8; color: var(--green); margin: 0 0 14px; text-align: right; }
.intro h2 { font-size: 21px; line-height: 1.3; margin: 0 0 8px; letter-spacing: -.01em; }
.intro p { margin: 0; color: var(--muted); max-width: 60ch; }
.sample {
  margin-top: 18px; display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px 9px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); font-weight: 600; color: var(--deep);
}
.sample svg { width: 18px; height: 18px; fill: var(--green); }
.sample:hover { border-color: var(--green); }
.sample:disabled { opacity: .5; }

/* list */
.list-bar { display: flex; align-items: center; gap: 8px; margin: 22px 0 10px; color: var(--muted); font-size: 13px; }
.spacer { flex: 1; }
.ghost {
  border: 1px solid var(--line); background: var(--card); border-radius: 8px;
  padding: 4px 11px; font-size: 13px; color: var(--text);
}
.ghost:hover:not(:disabled) { border-color: var(--green); }
.ghost:disabled { opacity: .45; }
.list { display: flex; flex-direction: column; gap: 12px; }

.entry {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow); padding: 14px 16px 12px;
  animation: enter .25s ease-out;
}
@keyframes enter { from { opacity: 0; transform: translateY(8px); } }
.entry.live { border-color: color-mix(in srgb, var(--green) 55%, var(--line)); }
.entry-head { display: flex; align-items: center; gap: 11px; }
.kind {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--panel); color: var(--green);
}
.kind svg { width: 16px; height: 16px; fill: currentColor; }
.entry.live .kind { background: var(--green); color: #fff; }
.title { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.name { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; }
.state:not(:empty)::before { content: "·"; margin-right: 6px; }
.entry.live .state { color: var(--green); font-weight: 500; }
.entry.failed .state { color: var(--red); }
.duration { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }
.actions { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 28px; height: 28px; border-radius: 8px; border: 0; background: none; display: grid; place-items: center; color: var(--muted);
}
.icon-btn svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; fill: none; }
.icon-btn:hover:not(:disabled) { background: var(--panel); color: var(--text); }
.icon-btn:disabled { opacity: .35; }

.progress { height: 4px; background: var(--panel); border-radius: 2px; overflow: hidden; margin: 12px 0 2px; }
.progress i { display: block; height: 100%; width: 0; background: var(--green); transition: width .2s linear; }

.text { font-family: var(--ug); font-size: 23px; line-height: 1.9; margin-top: 8px; text-align: right; }
.text:empty { display: none; }
.line { display: flex; align-items: baseline; gap: 14px; margin: 0; padding: 1px 0; }
.line .t { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.line time {
  direction: ltr; flex: none; font: 11.5px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted); opacity: .8; min-width: 36px; text-align: left; position: relative; top: -2px;
}
.line.partial .t { color: var(--green); }
.line.partial .t::after {
  content: ""; display: inline-block; width: 2px; height: .9em; margin-inline-start: 4px; vertical-align: -0.1em;
  background: var(--green); animation: blink 1s steps(1) infinite;
}
.note { font-family: var(--ui); font-size: 14px; color: var(--muted); text-align: left; direction: ltr; margin-top: 6px; }
.entry.failed .note { color: var(--red); }

.entry-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.entry-foot audio { height: 34px; flex: 1 1 260px; min-width: 0; max-width: 420px; }
.stats { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; margin-left: auto; }

/* dock */
.dock {
  position: sticky; bottom: 0; z-index: 5;
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--line);
}
.controls { display: flex; align-items: center; gap: 12px; }
.rec {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 52px; min-width: 140px; padding: 0 24px; border: 0; border-radius: 26px;
  background: var(--red); color: #fff; font-size: 16px; font-weight: 650;
  box-shadow: 0 2px 10px color-mix(in srgb, var(--red) 35%, transparent);
  transition: transform .1s;
}
.rec:active:not(:disabled) { transform: scale(.97); }
.rec:disabled { opacity: .5; }
.rec-dot { width: 13px; height: 13px; border-radius: 50%; background: #fff; transition: border-radius .15s; }
.rec.on .rec-dot { border-radius: 3px; animation: blink 1.2s ease-in-out infinite; }
.rec-info { display: flex; align-items: center; gap: 12px; }
.clock { font-variant-numeric: tabular-nums; font-size: 17px; font-weight: 600; white-space: nowrap; }
.clock .of { color: var(--muted); font-weight: 400; font-size: 14px; }
.clock.near { color: var(--amber); }
.meter { width: 80px; height: 6px; border-radius: 3px; background: var(--panel); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--green); transition: width 90ms linear; }
.upload {
  margin-left: auto; display: inline-flex; align-items: center; gap: 8px;
  height: 46px; padding: 0 18px; border-radius: 23px;
  border: 1px solid var(--line); background: var(--card); font-weight: 600; cursor: pointer;
}
.upload:hover { border-color: var(--green); }
.upload input { display: none; }
.upload svg { width: 19px; height: 19px; stroke: var(--green); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.status { margin: 8px 2px 0; font-size: 13px; color: var(--muted); min-height: 1.5em; }
.status.error { color: var(--red); }
.access { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; font-size: 14px; }
.access input { flex: 1 1 140px; max-width: 220px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); }
.access button { padding: 6px 14px; border-radius: 8px; border: 0; background: var(--green); color: #fff; font-weight: 600; }

.dropzone {
  position: fixed; inset: 0; z-index: 20; display: grid; place-items: center;
  background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(4px);
}
.dropzone div {
  padding: 34px 44px; border: 2px dashed var(--green); border-radius: 22px; background: var(--card);
  font-size: 18px; font-weight: 600; color: var(--green);
}

@media (max-width: 560px) {
  .wrap { padding: 0 14px; }
  .top { padding-top: 14px; }
  .tagline { display: none; }
  .intro { padding: 22px 18px; margin-top: 16px; }
  .intro h2 { font-size: 18px; }
  .ug-hello { font-size: 21px; }
  .rec { min-width: 0; padding: 0 20px; height: 48px; }
  .upload { padding: 0 14px; height: 44px; }
  .meter { width: 36px; }
  .rec-info { gap: 8px; }
  .clock .of { font-size: 12px; }
  .srv-extra { display: none; }
  .server { max-width: 46vw; padding: 5px 9px; }
  .text { font-size: 21px; }
  .entry { padding: 12px 13px 10px; }
}
