
:root {
  --bg: #0b0d12;
  --bg-elev: #141821;
  --bg-card: #1a1f2b;
  --bg-card-hover: #222837;
  --line: rgba(226, 177, 74, 0.18);
  --line-strong: rgba(226, 177, 74, 0.4);
  --text: #f4f1ea;
  --muted: #9aa3b5;
  --gold: #e2b14a;
  --gold-dim: #b8892e;
  --danger: #f07167;
  --ok: #7dce82;
  --info: #7eb6ff;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  --radius: 16px;
  --font: "Segoe UI", system-ui, -apple-system, "Noto Sans Arabic", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--font); }
body { min-height: 100dvh; }
img { max-width: 100%; display: block; }
button, input { font: inherit; }
button { cursor: pointer; }
a { color: var(--gold); }

.wrap { width: min(1100px, calc(100% - 32px)); margin: 0 auto; }

header.app {
  position: sticky; top: 0; z-index: 20;
  background: rgba(11, 13, 18, 0.9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
header.app .inner { display: flex; align-items: center; gap: 16px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; margin-right: auto; }
.logo {
  width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--gold); background: #1c2230;
  display: grid; place-items: center;
  color: var(--gold); font-weight: 700; font-size: 12px; letter-spacing: 0.04em;
}
.brand h1 { font-size: 16px; margin: 0; font-weight: 650; }
.brand span { display: block; color: var(--muted); font-size: 11px; font-weight: 500; }

nav.tabs { display: flex; gap: 6px; }
nav.tabs button {
  background: transparent; color: var(--muted); border: 0; padding: 8px 12px; border-radius: 999px;
}
nav.tabs button[aria-current="page"] { background: #232a3a; color: var(--text); }
.who { color: var(--muted); font-size: 13px; }
.btn {
  border: 0; border-radius: 999px; padding: 10px 16px; font-weight: 650;
  background: var(--gold); color: #1a1408;
}
.btn.secondary { background: #232a3a; color: var(--text); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid #2a3142; }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.danger { background: #3a1f1f; color: #ffc9c5; }

.banner {
  margin: 18px auto 0; padding: 12px 16px; border-radius: 12px;
  background: #2a2416; color: #f2e1b6; border: 1px solid var(--line-strong);
}
.banner.warn { background: #3a1f1f; color: #ffd4d0; border-color: rgba(240,113,103,0.35); }

main { padding: 28px 0 80px; }

.hero-card, .panel {
  background: linear-gradient(180deg, #171c27, #12161f);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 36px 28px;
  box-shadow: var(--shadow);
  max-width: 520px;
  margin: 48px auto 0;
  text-align: center;
}
.hero-card h2, .panel h2 { margin: 0 0 8px; font-size: 28px; }
.hero-card p, .panel p { color: var(--muted); line-height: 1.55; }
.hero-card .btn { margin-top: 18px; }

.search-row {
  display: flex; gap: 10px; margin-bottom: 24px;
}
.search-row input {
  flex: 1; background: var(--bg-elev); color: var(--text);
  border: 1px solid #2a3142; border-radius: 999px; padding: 14px 18px; outline: none;
}
.search-row input:focus { border-color: var(--gold); }
.search-row .btn { padding-inline: 22px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}
.card {
  background: var(--bg-card); border: 1px solid #232a3a; border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; min-height: 100%;
}
.poster {
  aspect-ratio: 2/3; background: #0f131b; position: relative; overflow: hidden;
}
.poster img { width: 100%; height: 100%; object-fit: cover; }
.badge {
  position: absolute; top: 10px; left: 10px;
  background: rgba(11,13,18,0.82); color: var(--gold);
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  padding: 4px 8px; border-radius: 999px; text-transform: uppercase;
}
.card .body { padding: 12px 12px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card h3 { margin: 0; font-size: 15px; line-height: 1.3; }
.meta { color: var(--muted); font-size: 12px; }
.overview {
  color: var(--muted); font-size: 12px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card .btn { width: 100%; margin-top: auto; }

.req-list { display: flex; flex-direction: column; gap: 12px; }
.req {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center;
  background: var(--bg-card); border: 1px solid #232a3a; border-radius: 14px; padding: 10px;
}
.req img, .req .ph {
  width: 64px; height: 96px; object-fit: cover; border-radius: 8px; background: #0f131b;
}
.req h3 { margin: 0 0 4px; font-size: 16px; }
.status {
  justify-self: end; font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
  padding: 6px 10px; border-radius: 999px; background: #232a3a; color: var(--muted);
  white-space: nowrap;
}
.status.submitted, .status.searching { color: var(--info); background: #1a2a40; }
.status.waiting_for_server { color: var(--gold); background: #2a2416; }
.status.accepted, .status.available, .status.already_available, .status.downloading { color: var(--ok); background: #17321c; }
.status.already_requested, .status.partially_available { color: #f2e1b6; background: #2a2416; }
.status.failed, .status.not_linked { color: var(--danger); background: #3a1f1f; }

.empty { text-align: center; color: var(--muted); padding: 40px 10px; }

.note { color: var(--muted); font-size: 13px; margin: 0 0 20px; }

dialog {
  border: 1px solid var(--line-strong); border-radius: 20px;
  background: #151922; color: var(--text); padding: 0; width: min(420px, calc(100vw - 24px));
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(0,0,0,0.65); }
.dialog-body { padding: 22px; }
.dialog-body h2 { margin: 0 0 8px; font-size: 20px; }
.dialog-body p { color: var(--muted); margin: 0 0 16px; line-height: 1.5; }
.seasons { display: flex; flex-direction: column; gap: 8px; margin: 0 0 16px; max-height: 240px; overflow: auto; }
.seasons label { display: flex; gap: 10px; align-items: center; background: #1c2230; padding: 10px 12px; border-radius: 10px; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; }

.hidden { display: none !important; }
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: #222837; color: var(--text); border: 1px solid var(--line);
  padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); z-index: 40;
}

@media (max-width: 720px) {
  .who { display: none; }
  .req { grid-template-columns: 56px 1fr; }
  .status { justify-self: start; grid-column: 2; }
}
