:root {
  --bg: #07070b;
  --bg-soft: #0c0c13;
  --panel: #12121c;
  --panel-2: #181824;
  --panel-3: #1e1e2c;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f3f3f8;
  --dim: #9a9aad;
  --faint: #6e6e82;
  --accent: #ff3355;
  --accent-2: #7d5cff;
  --ok: #3ddc97;
  --warn: #ffb020;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: rgba(255, 51, 85, 0.35); }

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input { font: inherit; }
button { cursor: pointer; }

.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60rem 30rem at 18% -10%, rgba(125, 92, 255, 0.16), transparent 60%),
    radial-gradient(50rem 26rem at 95% 4%, rgba(255, 51, 85, 0.14), transparent 62%),
    linear-gradient(180deg, #0a0a11 0%, #07070b 45%, #07070b 100%);
}

/* ── top bar ─────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 14px clamp(18px, 4vw, 54px);
  background: rgba(7, 7, 11, 0.82);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  letter-spacing: 0.06em;
  font-size: 15px;
  white-space: nowrap;
}

.brand-play {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 8px;
  font-size: 11px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 18px rgba(255, 51, 85, 0.25);
}

.brand em {
  font-style: normal;
  color: var(--accent);
}

.searchbar {
  display: flex;
  flex: 1;
  max-width: 660px;
  margin-inline: auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  padding: 4px 4px 4px 18px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.searchbar:focus-within {
  border-color: rgba(125, 92, 255, 0.55);
  box-shadow: 0 0 0 4px rgba(125, 92, 255, 0.12);
}

.searchbar input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  padding: 9px 4px;
}

.searchbar input::placeholder { color: var(--faint); }

.searchbar button {
  border: 0;
  border-radius: 999px;
  padding: 9px 20px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #ff5f79);
}

.nav {
  display: flex;
  gap: 6px;
  white-space: nowrap;
}

.nav a {
  padding: 8px 13px;
  border-radius: 999px;
  color: var(--dim);
  font-weight: 600;
  font-size: 14px;
  transition: color 0.15s, background 0.15s;
}

.nav a:hover { color: var(--text); background: var(--panel); }
.nav a.active { color: var(--text); background: var(--panel-2); }

/* ── layout ──────────────────────────────────────────────────────── */
.app {
  width: min(1420px, calc(100% - clamp(28px, 7vw, 96px)));
  margin: 0 auto;
  padding: 34px 0 80px;
  min-height: 68vh;
}

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 0 20px 28px;
  color: var(--faint);
  font-size: 12.5px;
}

.dot { opacity: 0.5; }

/* ── hero ────────────────────────────────────────────────────────── */
.hero {
  padding: clamp(28px, 5vw, 58px) 0 clamp(22px, 4vw, 44px);
  max-width: 900px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 26px;
  height: 1px;
  background: var(--accent);
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.2rem, 6vw, 4.4rem);
  line-height: 1.03;
  letter-spacing: -0.035em;
  font-weight: 850;
}

.hero h1 span {
  background: linear-gradient(100deg, var(--accent) 0%, #ff7a8e 45%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero .sub {
  max-width: 620px;
  margin: 18px 0 0;
  color: var(--dim);
  font-size: clamp(14px, 1.7vw, 17px);
}

.hero-search {
  display: flex;
  gap: 10px;
  max-width: 620px;
  margin-top: 26px;
}

.hero-search input {
  flex: 1;
  min-width: 0;
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  outline: 0;
  color: var(--text);
  background: var(--panel);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.hero-search input:focus {
  border-color: rgba(255, 51, 85, 0.55);
  box-shadow: 0 0 0 4px rgba(255, 51, 85, 0.12);
}

.hero-search input::placeholder { color: var(--faint); }

/* ── section heads ───────────────────────────────────────────────── */
.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 30px 0 16px;
}

.section-head h2 {
  margin: 0;
  font-size: clamp(19px, 2.4vw, 25px);
  letter-spacing: -0.02em;
}

.section-head .hint { color: var(--faint); font-size: 13px; }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--faint);
  font-size: 13px;
}

.crumb a { color: var(--dim); }
.crumb a:hover { color: var(--text); }

.page-title {
  margin: 0;
  font-size: clamp(22px, 3.2vw, 34px);
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.page-title .muted { color: var(--dim); font-weight: 500; }

.page-sub {
  margin: 8px 0 0;
  color: var(--dim);
  font-size: 14px;
}

.section-hint {
  margin: 4px 0 0;
  color: var(--faint);
  font-size: 13px;
}

.hint {
  color: var(--faint);
  font-size: 12px;
}

/* ── grids + cards ───────────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
  gap: clamp(14px, 2vw, 22px);
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 0;
  padding: 0;
  background: transparent;
  text-align: left;
  color: var(--text);
  border-radius: var(--radius);
  transition: transform 0.22s ease;
}

.card:hover { transform: translateY(-5px); }

.poster {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  background:
    radial-gradient(120% 100% at 20% 10%, rgba(125, 92, 255, 0.34), transparent 60%),
    linear-gradient(150deg, #232335 0%, #14141e 70%);
  border: 1px solid var(--line);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

.poster::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, 0.42));
  pointer-events: none;
}

.poster img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.poster-letter {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.28);
  font-size: 54px;
  font-weight: 850;
  letter-spacing: -0.04em;
}

.card-title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font-size: 13.5px;
  font-weight: 650;
  line-height: 1.35;
}

.card-sub {
  margin-top: -5px;
  color: var(--faint);
  font-size: 12px;
}

.card .card-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(8, 8, 12, 0.72);
  color: var(--dim);
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
  backdrop-filter: blur(8px);
}

.card:hover .card-delete { opacity: 1; }
.card .card-delete:hover { color: #fff; background: rgba(255, 51, 85, 0.72); }

/* ── movie page ──────────────────────────────────────────────────── */
.movie-hero {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: clamp(20px, 3vw, 38px);
  align-items: start;
  margin-bottom: 34px;
}

.movie-hero .poster { border-radius: 18px; box-shadow: var(--shadow); }

.movie-hero h1 {
  margin: 4px 0 12px;
  font-size: clamp(24px, 3.6vw, 40px);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.meta-row { display: flex; flex-wrap: wrap; gap: 8px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--dim);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.pill.accent { color: #ffd9e0; border-color: rgba(255, 51, 85, 0.3); background: rgba(255, 51, 85, 0.12); }
.pill.violet { color: #e2d9ff; border-color: rgba(125, 92, 255, 0.32); background: rgba(125, 92, 255, 0.13); }
.pill.ok { color: #c9ffe8; border-color: rgba(61, 220, 151, 0.3); background: rgba(61, 220, 151, 0.1); }
.pill.warn { color: #ffe7b8; border-color: rgba(255, 176, 32, 0.3); background: rgba(255, 176, 32, 0.1); }

.movie-note {
  margin-top: 16px;
  max-width: 720px;
  color: var(--dim);
  font-size: 14px;
}

/* ── lists (qualities, episodes, servers) ────────────────────────── */
.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(24, 24, 36, 0.75), rgba(16, 16, 25, 0.75));
  transition: border-color 0.18s, background 0.18s, transform 0.18s;
}

.row:hover {
  border-color: var(--line-strong);
  background: linear-gradient(180deg, rgba(30, 30, 44, 0.9), rgba(20, 20, 31, 0.9));
  transform: translateX(2px);
}

.row-index {
  flex: 0 0 auto;
  width: 30px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.row-body { flex: 1; min-width: 0; }

.row-title {
  font-weight: 650;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-sub {
  margin-top: 3px;
  color: var(--faint);
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

/* ── buttons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s, transform 0.12s, opacity 0.15s;
}

.btn:hover { background: var(--panel-3); border-color: rgba(255, 255, 255, 0.24); }
.btn:active { transform: scale(0.98); }

.btn-primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), #ff5b76);
  color: #fff;
  box-shadow: 0 8px 20px rgba(255, 51, 85, 0.22);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #ff4662, #ff6c84);
  box-shadow: 0 10px 26px rgba(255, 51, 85, 0.3);
}

.btn-violet {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent-2), #9c80ff);
  color: #fff;
}

.btn-ghost { background: transparent; }
.btn-danger { color: #ffc2cb; border-color: rgba(255, 51, 85, 0.32); background: rgba(255, 51, 85, 0.09); }
.btn-danger:hover { background: rgba(255, 51, 85, 0.18); }
.btn-sm { padding: 7px 12px; font-size: 12.5px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.btn:disabled:hover { background: var(--panel-2); border-color: var(--line-strong); }

/* ── watch page ──────────────────────────────────────────────────── */
.watch {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: clamp(18px, 3vw, 34px);
  align-items: start;
}

.player-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #000;
  box-shadow: var(--shadow);
}

.player-wrap video {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
}

.player-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
  color: var(--dim);
  background: radial-gradient(60% 60% at 50% 40%, rgba(15, 15, 24, 0.55), rgba(4, 4, 8, 0.86));
  transition: opacity 0.25s;
}

.player-overlay[hidden] { display: none; }
.player-overlay strong { color: var(--text); font-size: 15px; }
.player-overlay .small { color: var(--faint); font-size: 12.5px; }

.watch-meta { margin: 18px 0 0; }
.watch-meta h1 {
  margin: 0 0 8px;
  font-size: clamp(20px, 2.7vw, 30px);
  line-height: 1.16;
  letter-spacing: -0.025em;
}

.watch-meta .sub { color: var(--dim); font-size: 13.5px; }

.status-card {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(20, 20, 31, 0.9), rgba(13, 13, 20, 0.9));
}

.status-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 13px;
}

.status-label { display: flex; align-items: center; gap: 8px; font-weight: 700; }

.status-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 10px;
  color: var(--faint);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.status-note {
  margin-top: 10px;
  color: var(--warn);
  font-size: 12px;
  line-height: 1.5;
}

.error-box {
  margin-top: 14px;
  padding: 13px 14px;
  border: 1px solid rgba(255, 51, 85, 0.3);
  border-radius: var(--radius-sm);
  background: rgba(255, 51, 85, 0.08);
  color: #ffc7cf;
  font-size: 13px;
}

.error-box details { margin-top: 8px; }
.error-box summary { cursor: pointer; color: rgba(255, 199, 207, 0.7); font-size: 12px; }
.error-box pre {
  margin: 8px 0 0;
  max-height: 140px;
  overflow: auto;
  color: rgba(255, 199, 207, 0.75);
  font-size: 11px;
  white-space: pre-wrap;
  word-break: break-word;
}

.watch-side .poster {
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.info-card {
  margin-top: 14px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
}

.info-card h3 {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}

.info-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  font-size: 12.5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.info-row:last-child { border-bottom: 0; }
.info-row span:first-child { color: var(--faint); }
.info-row span:last-child {
  color: var(--dim);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}

.watch-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.watch-actions .btn { width: 100%; }

.watch-actions.row {
  flex-direction: row;
  flex-wrap: wrap;
}

.watch-actions.row .btn { width: auto; }

/* ── modal / resolver ────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(3, 3, 6, 0.78);
  backdrop-filter: blur(10px);
  animation: fade-in 0.16s ease;
}

.modal {
  width: min(470px, 100%);
  padding: 26px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: linear-gradient(180deg, #171722 0%, #101017 100%);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
  animation: pop-in 0.2s ease;
}

.modal h3 { margin: 0 0 6px; font-size: 19px; letter-spacing: -0.02em; }
.modal p { margin: 0; color: var(--dim); font-size: 13.5px; }

.modal .resolve-body {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}

.modal .resolve-text { min-width: 0; }
.modal .resolve-step {
  margin-top: 4px;
  color: var(--dim);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal .resolve-elapsed {
  margin-top: 6px;
  color: var(--faint);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

.modal .error-box { margin-top: 4px; }

/* ── spinner ─────────────────────────────────────────────────────── */
.spinner {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--accent);
  border-right-color: var(--accent-2);
  animation: spin 0.8s linear infinite;
}

.spinner.lg { width: 46px; height: 46px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(10px) scale(0.985); } to { opacity: 1; transform: none; } }

/* ── loading / empty ─────────────────────────────────────────────── */
.loading, .empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 300px;
  color: var(--dim);
  text-align: center;
}

.loading p, .empty p { max-width: 520px; margin: 0; }
.empty h2 { margin: 0; color: var(--text); font-size: 22px; letter-spacing: -0.02em; }
.empty .hint { color: var(--faint); font-size: 13px; }

.shimmer {
  position: relative;
  overflow: hidden;
  background: var(--panel);
}

.shimmer::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer { to { transform: translateX(100%); } }

/* ── toast ───────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  z-index: 120;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  max-width: min(520px, calc(100vw - 40px));
  padding: 12px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(24, 24, 36, 0.96);
  color: var(--text);
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: pop-in 0.2s ease;
}

.toast.error { border-color: rgba(255, 51, 85, 0.45); color: #ffc7cf; }

/* ── responsive ──────────────────────────────────────────────────── */
@media (max-width: 980px) {
  .watch { grid-template-columns: 1fr; }
  .watch-side { display: grid; grid-template-columns: 160px 1fr; gap: 14px; align-items: start; }
  .watch-side .poster { grid-row: span 3; }
  .watch-actions { margin-top: 0; }
}

@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: 12px; padding: 12px 16px; }
  .brand { order: 1; }
  .nav { order: 2; margin-left: auto; }
  .searchbar { order: 3; flex-basis: 100%; max-width: none; }
  .brand em { display: inline; }
  .app { padding-top: 22px; }
  .movie-hero { grid-template-columns: 130px 1fr; }
  .movie-hero h1 { font-size: clamp(20px, 5vw, 28px); }
  .row { flex-wrap: wrap; gap: 10px; }
  .row-actions { width: 100%; justify-content: flex-start; padding-left: 46px; }
  .watch-side { grid-template-columns: 1fr; }
  .watch-side .poster { max-width: 160px; grid-row: auto; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

@media (max-width: 460px) {
  .movie-hero { grid-template-columns: 1fr; }
  .movie-hero .poster { width: 140px; }
  .hero-search { flex-direction: column; }
}
