/* واجهة هادئة: ألوان ثابتة، بدون توهج أو لمعان أو حركة مستمرة */
:root {
  --bg: #0f1013;
  --surface: #16181d;
  --surface-2: #1d2026;
  --line: rgba(255, 255, 255, .07);
  --text: #e8e9ed;
  --muted: #8a8f9b;
  --accent: #93b8a6;           /* أخضر رمادي هادي */
  --accent-soft: rgba(147, 184, 166, .12);
  --accent-line: rgba(147, 184, 166, .4);
  --ink: #0f1613;              /* لون النص فوق الأخضر */
  --danger: #c98a85;
  --r-lg: 24px;
  --ease: cubic-bezier(.3, .7, .3, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.6 "Readex Pro", -apple-system, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
  -webkit-user-select: none; user-select: none;
}
input { -webkit-user-select: text; user-select: text; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

/* ---------- الهيكل ---------- */
.app {
  max-width: 460px; margin: 0 auto; min-height: 100dvh;
  padding: calc(env(safe-area-inset-top) + 18px) max(18px, env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + 24px) max(18px, env(safe-area-inset-left));
}
/* شريط ثابت فوق: الموقع تابع لـ not-sal.com (رابط يفتح صفحة جديدة) */
.site-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  height: calc(env(safe-area-inset-top) + 38px); padding-top: env(safe-area-inset-top);
  background: var(--bg); border-bottom: 1px solid var(--line);
  color: var(--muted); font-size: 13px; text-decoration: none;
}
.site-bar bdi { color: var(--accent); }
.site-bar:hover bdi { text-decoration: underline; }
.site-bar + .app { padding-top: calc(env(safe-area-inset-top) + 56px); }
.site-bar + .app #view-input { min-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 80px); }
.view { display: flex; flex-direction: column; animation: fade .3s ease both; }
#view-input { min-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 42px); justify-content: center; }
@keyframes fade { from { opacity: 0; } }

/* ---------- الهيرو ---------- */
.hero { text-align: center; padding: 8px 0 26px; }
h1 { margin: 0; font-size: clamp(30px, 9vw, 38px); line-height: 1.25; font-weight: 600; letter-spacing: -.01em; }
.hl { color: var(--accent); }
.lead { margin: 12px auto 0; max-width: 34ch; color: var(--muted); font-size: 15.5px; }

/* ---------- اختيار المسارات ---------- */
.picker { margin: 0 0 14px; }
.pk-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 4px 10px; }
.pk-head h2 { margin: 0; font-size: 15.5px; font-weight: 500; }
.pk-sum { font-size: 12.5px; color: var(--muted); text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pk-sum.bad { color: var(--danger); }

.stems { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stem {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 14px; min-height: 104px; text-align: right;
  border-radius: 20px; background: var(--surface); border: 1px solid var(--line);
  transition: background .2s, border-color .2s;
}
.s-ic { position: relative; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 8px; color: var(--muted); background: var(--surface-2); transition: background .2s, color .2s; }
.s-ic::after { content: ""; position: absolute; width: 26px; height: 2px; border-radius: 2px; background: var(--danger); transform: rotate(-45deg); transition: opacity .2s; }
.stem b { font-size: 15px; font-weight: 500; color: var(--muted); transition: color .2s; }
.stem b .hint { font-weight: 400; font-size: 12px; color: var(--muted); white-space: nowrap; }
.stem small { font-size: 12.5px; color: var(--danger); }
.stem small::before { content: "ينشال"; }
.stem[aria-pressed="true"] { border-color: var(--accent-line); background: var(--accent-soft); }
.stem[aria-pressed="true"] .s-ic { color: var(--accent); background: rgba(147, 184, 166, .16); }
.stem[aria-pressed="true"] .s-ic::after { opacity: 0; }
.stem[aria-pressed="true"] b { color: var(--text); }
.stem[aria-pressed="true"] small { color: var(--accent); }
.stem[aria-pressed="true"] small::before { content: "يبقى"; }


/* ---------- المدخل ---------- */
.field {
  display: flex; align-items: center; gap: 6px; padding: 6px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--line); transition: border-color .2s;
}
.field:focus-within { border-color: var(--accent-line); }
.field-ic { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.field input { flex: 1; min-width: 0; height: 44px; background: none; border: 0; outline: 0; color: var(--text); font: inherit; font-size: 16px; text-align: left; padding: 0 6px; }
.field input::placeholder { color: #565b66; }
.field input:placeholder-shown { direction: rtl; text-align: right; }
.paste { min-height: 44px; padding: 0 16px; border-radius: 13px; background: var(--surface-2); color: var(--text); font-size: 15px; transition: background .2s; }
.paste:active { background: #262a32; }

.err { display: flex; align-items: center; gap: 8px; margin: 12px 4px 0; color: var(--danger); font-size: 14.5px; }
.err svg { width: 18px; height: 18px; }

.cta {
  width: 100%; min-height: 56px; margin-top: 14px; border-radius: 18px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  color: var(--ink); font-size: 17px; font-weight: 600; background: var(--accent);
  transition: opacity .2s, background .2s;
}
.cta svg { width: 20px; height: 20px; stroke-width: 2.2; }
.cta:active { opacity: .85; }
.cta:disabled { opacity: .4; }
.cta.loading span::after { content: "…"; }


.install { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 5px; margin-top: 26px; color: var(--muted); font-size: 13.5px; }
.install svg { width: 17px; height: 17px; }

/* ---------- الغلاف ---------- */
.cover { position: relative; overflow: hidden; border-radius: var(--r-lg); background: var(--surface-2); border: 1px solid var(--line); }
.cover.big { width: min(76vw, 290px); aspect-ratio: 1; margin: 20px auto 0; }
.cover-art { position: absolute; inset: 0; background-size: cover; background-position: center; }
.tag {
  position: absolute; bottom: 10px; right: 10px; display: flex; align-items: center; gap: 5px; padding: 5px 11px; border-radius: 99px;
  font-size: 12.5px; font-weight: 500; color: var(--text); background: rgba(15, 16, 19, .78);
}
.tag svg { width: 14px; height: 14px; stroke-width: 2.4; color: var(--accent); }

/* ---------- المعالجة ---------- */
.work { display: flex; flex-direction: column; text-align: center; padding-top: 8px; }
#wcover .cover-art { opacity: .75; }
.w-title { margin: 24px 0 0; font-size: 19px; font-weight: 500; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.w-sub { margin: 2px 0 0; color: var(--muted); font-size: 14.5px; min-height: 1.5em; }
.meter { height: 6px; margin-top: 22px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--accent); margin-inline-start: 0; transition: width .8s var(--ease); }
.w-row { display: flex; justify-content: space-between; margin-top: 10px; font-size: 14.5px; color: var(--muted); }
.w-row b { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }

.timeline { list-style: none; margin: 24px 0 0; padding: 4px 16px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); text-align: right; }
.timeline li { display: flex; align-items: center; gap: 12px; padding: 12px 0; color: var(--muted); transition: color .2s; }
.timeline li + li { border-top: 1px solid var(--line); }
.timeline li i { position: relative; width: 22px; height: 22px; border-radius: 50%; flex: none; border: 1.5px solid rgba(255, 255, 255, .16); transition: background .2s, border-color .2s; }
.timeline li.on { color: var(--text); }
.timeline li.on i { border-color: var(--accent); background: radial-gradient(circle, var(--accent) 0 3.5px, transparent 4.5px); }
.timeline li.ok { color: var(--muted); }
.timeline li.ok i { border-color: var(--accent); background: var(--accent); }
.timeline li.ok i::after { content: ""; position: absolute; left: 6px; top: 3px; width: 5px; height: 9px; border: solid var(--ink); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.w-note { margin: 18px 0 0; font-size: 13.5px; color: #636875; }

/* ---------- المشغل ---------- */
.player { display: flex; flex-direction: column; text-align: center; }
.p-title { margin: 24px 0 0; font-size: 20px; font-weight: 500; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.p-sub { margin: 2px 0 0; color: var(--muted); font-size: 14.5px; min-height: 1.5em; }
.scrub { margin-top: 20px; }
#seek { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: none; margin: 0; cursor: pointer; --pos: 0%; }
#seek::-webkit-slider-runnable-track { height: 4px; border-radius: 99px; background: linear-gradient(to right, var(--accent) var(--pos), rgba(255, 255, 255, .12) var(--pos)); }
#seek::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: var(--text); }
#seek::-moz-range-track { height: 4px; border-radius: 99px; background: rgba(255, 255, 255, .12); }
#seek::-moz-range-progress { height: 4px; border-radius: 99px; background: var(--accent); }
#seek::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: var(--text); }
.times { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.controls { display: flex; align-items: center; justify-content: center; gap: 28px; margin: 12px 0 10px; }
.ctl { width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); transition: background .2s; }
.ctl:active { background: var(--surface-2); }
.ctl svg { width: 23px; height: 23px; }
.play { width: 68px; height: 68px; border-radius: 50%; display: grid; place-items: center; color: var(--ink); background: var(--text); transition: opacity .2s; }
.play:active { opacity: .85; }
.play svg { width: 26px; height: 26px; grid-area: 1 / 1; transition: opacity .15s; }
.play .i-pause, .play.on .i-play { opacity: 0; }
.play.on .i-pause { opacity: 1; }
.fmt { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-top: 18px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.fmt button { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; border-radius: 12px; color: var(--muted); font-size: 15px; transition: background .2s, color .2s; }
.fmt button svg { width: 18px; height: 18px; }
.fmt button[aria-pressed="true"] { background: var(--surface-2); color: var(--text); }
.ghost { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 52px; margin-top: 10px; border-radius: 16px; font-size: 15.5px; color: var(--text); background: var(--surface); border: 1px solid var(--line); transition: background .2s; }
.ghost:active { background: var(--surface-2); }
.ghost svg { width: 18px; height: 18px; }

@media (max-height: 700px) {
  .cover.big { width: min(58vw, 220px); }
  .hero { padding: 0 0 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
}
