:root {
  --bg: #0f0f14;
  --card: #1a1a22;
  --line: #2c2c38;
  --text: #f2f2f5;
  --muted: #9a9aa8;
  --accent: #fe2c55;
  --accent2: #25f4ee;
  --radius: 14px;
}
@media (prefers-color-scheme: light) {
  :root { --bg: #f6f6f8; --card: #fff; --line: #e2e2e8; --text: #16161d; --muted: #666674; }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Tahoma, "Noto Sans Arabic", sans-serif;
}

.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; max-width: 640px; width: 100%; margin: 0 auto;
}
.logo { color: var(--text); font-weight: 800; font-size: 22px; text-decoration: none; }
.logo::first-letter { color: var(--accent); }
#lang {
  background: var(--card); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 14px;
}

main { flex: 1; width: 100%; max-width: 640px; margin: 0 auto; padding: 16px; }
h1 { font-size: clamp(24px, 6vw, 34px); line-height: 1.2; margin: 12px 0 6px; text-align: center; }
.sub { color: var(--muted); text-align: center; margin: 0 0 22px; }

form { display: grid; gap: 10px; }
.field {
  display: flex; align-items: center; gap: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 6px;
}
.field:focus-within { border-color: var(--accent); }
#url {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text);
  font: inherit; padding: 12px 10px;
}

button, .btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 12px; cursor: pointer; font: inherit; font-weight: 700;
  text-decoration: none; min-height: 48px; padding: 0 18px;
  -webkit-tap-highlight-color: transparent;
}
.primary { background: var(--accent); color: #fff; }
.primary:active { transform: scale(.98); }
.secondary { background: transparent; color: var(--text); border: 1.5px solid var(--line); }
.small { background: transparent; color: var(--muted); min-height: 38px; font-size: 14px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.ghost { background: var(--line); color: var(--text); min-height: 40px; padding: 0 14px; font-size: 14px; }
button[disabled] { opacity: .6; cursor: wait; }

.msg { min-height: 1.5em; text-align: center; color: var(--muted); margin: 14px 0; }
.msg.error { color: var(--accent); }

.result {
  display: flex; gap: 14px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px;
}
.result[hidden] { display: none; }
#cover[hidden] { display: none; }
#cover { width: 96px; height: 128px; object-fit: cover; border-radius: 10px; background: var(--line); flex: none; }
.info { flex: 1; min-width: 0; }
.vtitle {
  margin: 0 0 4px; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.vauthor { margin: 0 0 10px; color: var(--muted); font-size: 14px; }
.actions { display: grid; gap: 8px; }
.actions .btn[hidden] { display: none; }

.steps { color: var(--muted); padding-inline-start: 20px; margin: 28px 0 0; font-size: 15px; }
.steps li { margin: 6px 0; }

footer { text-align: center; color: var(--muted); font-size: 13px; padding: 20px 16px; }

@media (max-width: 380px) {
  .result { flex-direction: column; }
  #cover { width: 100%; height: 200px; }
}

.btn.busy { pointer-events: none; opacity: .85; gap: 8px; }
.btn.busy::before {
  content: ""; width: 16px; height: 16px; flex: none;
  border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.msg a { color: inherit; font-weight: 700; }
.btn.ready {
  background: var(--accent); color: #fff; border-color: var(--accent); text-decoration: none;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 25%, transparent); } }
@media (prefers-reduced-motion: reduce) { .btn.ready, .btn.busy::before { animation: none; } }
