:root {
  --bg: #0c0a14;
  --bg-2: #120f1f;
  --surface: rgba(28, 23, 45, 0.72);
  --surface-solid: #1a1528;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #ece9f5;
  --muted: #9b95b3;
  --accent: #8b5cf6;
  --accent-2: #c084fc;
  --accent-soft: rgba(139, 92, 246, 0.16);
  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.14);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.14);
  --warning: #fbbf24;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 0 40px -6px rgba(139, 92, 246, 0.45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(139, 92, 246, 0.18), transparent 60%),
    radial-gradient(900px 500px at 0% 100%, rgba(192, 132, 252, 0.10), transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(600px 300px at 50% -5%, rgba(139, 92, 246, 0.12), transparent 70%);
  z-index: 0;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.accent { color: var(--accent-2); }
.muted { color: var(--muted); }
.hidden { display: none !important; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 0.4em; }

/* ---------- Loading ---------- */
.loading-screen {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background: var(--bg); z-index: 100;
}
.spinner {
  width: 42px; height: 42px;
  border: 3px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Layout / view ---------- */
.view { position: relative; z-index: 1; }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.25rem; }
.brand-logo { font-size: 1.5rem; filter: drop-shadow(0 0 10px rgba(139,92,246,0.6)); }
.brand-name { letter-spacing: -0.02em; }

/* ---------- Landing ---------- */
.landing-header {
  max-width: 1100px; margin: 0 auto;
  padding: 28px 24px 0;
}

.hero {
  max-width: 1100px; margin: 0 auto;
  padding: 48px 24px 64px;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 48px;
  align-items: center;
}
.hero-content h1 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 850;
  letter-spacing: -0.03em;
  margin-bottom: 18px;
}
.hero-sub { font-size: 1.1rem; color: var(--muted); max-width: 52ch; }
.hero-features {
  list-style: none; padding: 0; margin: 28px 0 0;
  display: grid; gap: 12px;
}
.hero-features li { display: flex; align-items: center; gap: 12px; color: var(--text); }
.hero-features .ico { font-size: 1.2rem; }

.landing-footer {
  max-width: 1100px; margin: 0 auto;
  padding: 28px 24px 40px;
  color: var(--muted); font-size: 0.85rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}

.auth-card { box-shadow: var(--shadow), var(--shadow-glow); }
.auth-card h2 { font-size: 1.5rem; }

/* ---------- Forms ---------- */
.stack { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 0.85rem; color: var(--muted); font-weight: 600; }

input[type="text"], input[type="email"], textarea, select {
  width: 100%;
  background: rgba(10, 8, 18, 0.6);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 12px 14px;
  font-size: 0.97rem;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: rgba(10, 8, 18, 0.85);
}
textarea { resize: vertical; }
.select { appearance: none; cursor: pointer; padding-right: 14px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  font-size: 0.95rem; font-weight: 650;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s, box-shadow 0.15s, border-color 0.15s, opacity 0.15s;
  white-space: nowrap;
  color: var(--text);
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 8px 24px -8px rgba(139, 92, 246, 0.7);
}
.btn-primary:hover { box-shadow: 0 10px 30px -8px rgba(139, 92, 246, 0.85); }

.btn-soft { background: var(--accent-soft); color: var(--accent-2); border-color: var(--border-strong); }
.btn-soft:hover { background: rgba(139, 92, 246, 0.26); }

.btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.05); }

.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: rgba(248,113,113,0.35); }
.btn-danger:hover { background: rgba(248, 113, 113, 0.24); }

.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }

.btn-icon {
  background: transparent; border: 1px solid var(--border-strong);
  color: var(--muted); padding: 6px 10px; font-size: 0.85rem;
  border-radius: 8px; cursor: pointer; transition: all 0.15s;
}
.btn-icon:hover { color: var(--text); border-color: var(--accent); }
.btn-icon.ok:hover { color: var(--success); border-color: var(--success); }
.btn-icon.no:hover { color: var(--danger); border-color: var(--danger); }

/* ---------- Notices ---------- */
.notice {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; border-radius: var(--radius-sm);
  font-size: 0.92rem; margin-top: 6px;
  border: 1px solid var(--border-strong);
}
.notice .ico { font-size: 1.3rem; line-height: 1; }
.notice-success { background: var(--success-soft); border-color: rgba(52,211,153,0.3); color: #c6f4e2; }
.notice-warning { background: rgba(251,191,36,0.12); border-color: rgba(251,191,36,0.35); color: #f8e3b0; }

/* ---------- App header ---------- */
.app-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
  background: rgba(12, 10, 20, 0.7);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.user-box { display: flex; align-items: center; gap: 16px; }
.user-meta { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.user-name { font-weight: 700; }
.user-email { font-size: 0.8rem; }

/* ---------- Dashboard ---------- */
.dashboard {
  max-width: 920px; margin: 0 auto;
  padding: 32px 24px 16px;
  display: grid; gap: 24px;
}
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-head h2 { font-size: 1.3rem; margin: 0; }
.subsection { margin-top: 22px; }
.sub-title { font-size: 0.95rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 10px; }

/* ---------- Manifest row ---------- */
.manifest-row { display: flex; gap: 10px; margin-top: 14px; }
.manifest-input {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.85rem; color: var(--accent-2);
}

/* ---------- Inline / search forms ---------- */
.inline-form { display: flex; gap: 10px; }
.inline-form input { flex: 1; }
.search-bar { display: flex; gap: 10px; flex-wrap: wrap; }
.search-bar input { flex: 1; min-width: 180px; }
.search-bar .select { width: auto; min-width: 120px; }

/* ---------- Lists ---------- */
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.list-item .li-main { flex: 1; min-width: 0; }
.li-name { font-weight: 650; }
.li-sub { font-size: 0.82rem; color: var(--muted); word-break: break-word; }
.li-actions { display: flex; gap: 8px; flex-shrink: 0; }
.empty { color: var(--muted); font-size: 0.9rem; font-style: italic; padding: 6px 2px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block; font-size: 0.72rem; font-weight: 700;
  padding: 2px 9px; border-radius: 999px; letter-spacing: 0.03em;
  text-transform: uppercase;
}
.badge-pending { background: rgba(251,191,36,0.15); color: var(--warning); }
.badge-watched, .badge-seen { background: var(--success-soft); color: var(--success); }
.badge-dismissed { background: var(--danger-soft); color: var(--danger); }
.badge-created { background: var(--accent-soft); color: var(--accent-2); }

/* ---------- Suggestions ---------- */
.suggestions .list-item { flex-direction: column; align-items: stretch; }
.sugg-top { display: flex; align-items: center; gap: 12px; }
.sugg-poster {
  width: 46px; height: 68px; border-radius: 6px; object-fit: cover;
  background: rgba(255,255,255,0.05); flex-shrink: 0;
}
.sugg-note {
  margin-top: 8px; padding: 8px 12px;
  background: rgba(139, 92, 246, 0.08);
  border-left: 3px solid var(--accent);
  border-radius: 6px; font-size: 0.9rem; color: #d8d2ea;
}
.sugg-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* ---------- Search results grid ---------- */
.results-grid {
  display: grid; gap: 16px; margin-top: 18px;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
.result-card {
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: rgba(255,255,255,0.03);
  transition: transform 0.12s, border-color 0.15s, box-shadow 0.15s;
}
.result-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 14px 30px -14px rgba(139,92,246,0.7);
}
.result-poster {
  width: 100%; aspect-ratio: 2 / 3; object-fit: cover; display: block;
  background: linear-gradient(135deg, #241c38, #16111f);
}
.result-poster.placeholder {
  display: grid; place-items: center; color: var(--muted); font-size: 2rem;
}
.result-info { padding: 10px 12px; }
.result-title { font-weight: 650; font-size: 0.9rem; line-height: 1.25; }
.result-year { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }

/* ---------- Danger section ---------- */
.danger-section { border-color: rgba(248, 113, 113, 0.25); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(5, 4, 10, 0.7);
  backdrop-filter: blur(6px);
  display: grid; place-items: center;
  padding: 20px;
  animation: fade 0.15s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal { position: relative; width: 100%; max-width: 440px; }
.modal-close {
  position: absolute; top: 16px; right: 16px;
  background: transparent; border: none; color: var(--muted);
  font-size: 1.1rem; cursor: pointer; padding: 4px;
}
.modal-close:hover { color: var(--text); }
.modal h3 { font-size: 1.25rem; }
.modal-media { display: flex; gap: 14px; align-items: center; margin: 14px 0 20px; }
.modal-media img {
  width: 60px; height: 90px; object-fit: cover; border-radius: 8px;
  background: rgba(255,255,255,0.05);
}
.modal-media-name { font-weight: 700; }

/* ---------- Toasts ---------- */
.toasts {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: grid; gap: 10px; width: min(420px, calc(100% - 32px));
}
.toast {
  padding: 13px 18px; border-radius: var(--radius-sm);
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  font-size: 0.92rem; font-weight: 550;
  display: flex; align-items: center; gap: 10px;
  animation: toast-in 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.toast.success { border-color: rgba(52,211,153,0.5); }
.toast.error { border-color: rgba(248,113,113,0.5); }
.toast.info { border-color: var(--border-strong); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }
.toast.leaving { animation: toast-out 0.25s forwards; }
@keyframes toast-out { to { opacity: 0; transform: translateY(-12px); } }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 32px; padding-top: 32px; }
  .auth-card { order: -1; }
}
@media (max-width: 560px) {
  .card { padding: 20px; }
  .app-header { padding: 14px 16px; }
  .user-meta { display: none; }
  .manifest-row, .inline-form { flex-direction: column; }
  .btn-row .btn { flex: 1; }
  .results-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; }
}
