:root {
  --bg: #08080d;
  --surface: #14141f;
  --surface-2: #1c1c2b;
  --cyan: #00f0ff;
  --magenta: #ff2d95;
  --text: #eef0ff;
  --muted: #8b8ca8;
  --line: rgba(255,255,255,0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(255,45,149,0.14), transparent 60%),
    radial-gradient(900px 500px at 10% 10%, rgba(0,240,255,0.12), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: 'Bricolage Grotesque', sans-serif;
  min-height: 100vh;
}

/* subtle film-grain */
body::after {
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 9999;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23n)'/%3E%3C/svg%3E");
}

.app-root { max-width: 1280px; margin: 0 auto; padding: 0 20px 60px; }

/* Header */
.header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(8,8,13,0.72);
  border-bottom: 1px solid var(--line);
  margin: 0 -20px 24px;
  padding: 0 20px;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 1280px; margin: 0 auto; padding: 16px 0; gap: 12px; flex-wrap: wrap;
}
.brand { display: flex; flex-direction: column; }
.logo {
  margin: 0; font-size: 1.9rem; font-weight: 800; letter-spacing: -0.02em;
  background: linear-gradient(90deg, var(--cyan), var(--magenta));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 24px rgba(0,240,255,0.25);
}
.tagline {
  font-family: 'IBM Plex Mono', monospace; font-size: 0.72rem;
  letter-spacing: 0.32em; text-transform: uppercase; color: var(--muted); margin-top: 2px;
}
.header-right { display: flex; align-items: center; gap: 12px; }
.turbo-toggle {
  display: flex; align-items: center; gap: 6px; cursor: pointer;
  font-size: 0.85rem; color: var(--muted); user-select: none;
}
.turbo-toggle input { accent-color: var(--magenta); width: 16px; height: 16px; }
.vault-open-btn {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line);
  padding: 9px 16px; border-radius: 999px; cursor: pointer; font-weight: 600;
  font-family: inherit; transition: .2s; font-size: 0.9rem;
}
.vault-open-btn:hover { border-color: var(--cyan); box-shadow: 0 0 18px rgba(0,240,255,0.2); }
.vault-count {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px;
  border-radius: 999px; background: var(--magenta); color: #fff; font-size: 0.75rem;
  padding: 0 6px; margin-left: 4px;
}

/* Controls */
.controls { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.search-wrap { flex: 1; min-width: 240px; position: relative; }
.search-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); opacity: .6; }
.search-input {
  width: 100%; padding: 14px 18px 14px 44px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--text);
  font-family: inherit; font-size: 1rem; outline: none; transition: .2s;
}
.search-input::placeholder { color: var(--muted); }
.search-input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0,240,255,0.15); }
.surprise-btn {
  background: linear-gradient(90deg, var(--magenta), #ff6ab5); color: #fff; border: none;
  padding: 0 22px; border-radius: 999px; cursor: pointer; font-weight: 700; font-family: inherit;
  font-size: 0.95rem; white-space: nowrap; transition: transform .15s, box-shadow .2s;
}
.surprise-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(255,45,149,0.35); }

/* Stats */
.stats-strip {
  display: flex; gap: 10px; align-items: center; margin-bottom: 22px;
  font-family: 'IBM Plex Mono', monospace; font-size: 0.82rem; color: var(--muted);
}
.stats-strip .dot { opacity: .4; }

/* Grid */
.grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
.no-results { grid-column: 1/-1; text-align: center; padding: 60px 0; color: var(--muted); font-size: 1.1rem; }

/* Card */
.movie-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  overflow: hidden; cursor: pointer; display: flex; flex-direction: column;
  transition: transform .2s, box-shadow .25s, border-color .2s;
  opacity: 0; animation: rise .5s forwards;
}
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.movie-card:hover {
  transform: translateY(-6px); border-color: rgba(0,240,255,0.5);
  box-shadow: 0 14px 40px rgba(0,0,0,0.5), 0 0 30px rgba(0,240,255,0.18);
}
.poster-wrap { position: relative; aspect-ratio: 2/3; background: var(--surface-2); }
.card-hover-shade {
  position: absolute; inset: 0; opacity: 0; transition: .25s;
  background: linear-gradient(0deg, rgba(255,45,149,0.25), transparent 55%);
}
.movie-card:hover .card-hover-shade { opacity: 1; }
.rating-badge {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  background: rgba(8,8,13,0.85); border: 1px solid var(--line);
  color: var(--cyan); font-family: 'IBM Plex Mono', monospace; font-size: 0.78rem;
  padding: 3px 9px; border-radius: 999px; font-weight: 600;
}
.poster-fallback {
  width: 100%; height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 16px; text-align: center;
  background: linear-gradient(135deg, var(--surface-2), #23233a);
}
.poster-fallback-title { font-weight: 800; font-size: 1.1rem; }
.poster-fallback-genre { color: var(--muted); font-size: 0.8rem; margin-top: 6px; font-family: 'IBM Plex Mono', monospace; }
.card-meta { padding: 12px 12px 6px; }
.card-title { font-weight: 700; font-size: 1rem; line-height: 1.2; }
.card-sub { color: var(--muted); font-size: 0.8rem; margin-top: 3px; }
.card-action { padding: 8px 12px 14px; margin-top: auto; }

/* Download button */
.dl-btn {
  width: 100%; padding: 9px 12px; border-radius: 10px; border: none; cursor: pointer;
  font-family: inherit; font-weight: 700; font-size: 0.85rem; text-align: center;
  transition: .2s;
}
.dl-go { background: linear-gradient(90deg, var(--cyan), #4dd0ff); color: #041018; }
.dl-go:hover { box-shadow: 0 0 18px rgba(0,240,255,0.45); transform: translateY(-1px); }
.dl-in-vault { background: rgba(0,240,255,0.1); color: var(--cyan); border: 1px solid rgba(0,240,255,0.3); }
.dl-done { background: var(--magenta); color: #fff; animation: pop .4s; }
@keyframes pop { 0% { transform: scale(.9); } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }
.dl-progress {
  position: relative; width: 100%; height: 34px; border-radius: 10px;
  background: var(--surface-2); overflow: hidden; border: 1px solid var(--line);
}
.dl-bar {
  position: absolute; inset: 0; width: 0;
  background: linear-gradient(90deg, var(--cyan), var(--magenta));
  transition: width .22s linear;
  background-size: 200% 100%; animation: shimmer 1s linear infinite;
}
@keyframes shimmer { to { background-position: 200% 0; } }
.dl-progress-text {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: 'IBM Plex Mono', monospace; font-size: 0.68rem; font-weight: 600;
  color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.6); padding: 0 6px; z-index: 2;
}

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center;
  padding: 20px; background: rgba(4,4,10,0.72); backdrop-filter: blur(6px);
  animation: fade .2s;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  position: relative; width: 100%; max-width: 720px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 20px; overflow: hidden;
  animation: rise .3s;
}
.modal-close {
  position: absolute; top: 12px; right: 12px; z-index: 5;
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line);
  background: rgba(8,8,13,0.7); color: var(--text); cursor: pointer; font-size: 0.9rem;
}
.modal-grid { display: grid; grid-template-columns: 240px 1fr; }
.modal-poster { aspect-ratio: 2/3; background: var(--surface-2); }
.modal-info { padding: 24px; }
.modal-title { margin: 0 0 12px; font-size: 1.8rem; font-weight: 800; line-height: 1.1; }
.modal-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tag {
  font-family: 'IBM Plex Mono', monospace; font-size: 0.75rem; padding: 4px 10px;
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted);
}
.tag-rating { color: var(--cyan); border-color: rgba(0,240,255,0.3); }
.modal-blurb { color: #c7c9e0; line-height: 1.6; margin-bottom: 22px; }
.modal-action { max-width: 260px; }

/* Vault panel */
.vault-scrim { position: fixed; inset: 0; z-index: 150; background: rgba(4,4,10,0.55); backdrop-filter: blur(3px); }
.vault-panel {
  position: fixed; top: 0; right: 0; z-index: 160; height: 100%; width: 400px; max-width: 92vw;
  background: var(--surface); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; transform: translateX(105%); transition: transform .32s cubic-bezier(.3,.7,.3,1);
  box-shadow: -20px 0 60px rgba(0,0,0,0.5);
}
.vault-open { transform: translateX(0); }
.vault-header { display: flex; align-items: center; justify-content: space-between; padding: 20px; border-bottom: 1px solid var(--line); }
.vault-heading { margin: 0; font-size: 1.3rem; font-weight: 800; }
.vault-x { background: none; border: none; color: var(--muted); font-size: 1.1rem; cursor: pointer; }
.vault-filters { display: flex; gap: 8px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.vfilter {
  flex: 1; padding: 8px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--muted); cursor: pointer; font-family: inherit;
  font-size: 0.8rem; font-weight: 600; transition: .2s;
}
.vfilter-active { background: linear-gradient(90deg, rgba(0,240,255,0.2), rgba(255,45,149,0.2)); color: var(--text); border-color: var(--cyan); }
.vault-list { flex: 1; overflow-y: auto; padding: 14px 20px; display: flex; flex-direction: column; gap: 12px; }
.vault-empty { color: var(--muted); text-align: center; padding: 40px 10px; line-height: 1.6; }
.vault-item {
  display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line); transition: .2s;
}
.vault-watched { opacity: 0.55; }
.vault-watched .vault-thumb { filter: grayscale(1); }
.vault-thumb { width: 46px; height: 68px; border-radius: 6px; overflow: hidden; flex-shrink: 0; background: #000; }
.vault-item-info { flex: 1; min-width: 0; }
.vault-item-title { font-weight: 700; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vault-item-sub { color: var(--muted); font-size: 0.75rem; margin-top: 2px; }
.vault-item-actions { display: flex; flex-direction: column; gap: 6px; }
.vi-btn { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 7px; padding: 5px 8px; font-size: 0.72rem; cursor: pointer; font-family: inherit; white-space: nowrap; transition: .2s; }
.vi-btn.watch:hover { border-color: var(--cyan); color: var(--cyan); }
.vi-btn.remove:hover { border-color: var(--magenta); color: var(--magenta); }
.vault-footer { padding: 16px 20px; border-top: 1px solid var(--line); }
.share-btn {
  width: 100%; padding: 11px; border-radius: 10px; border: none; cursor: pointer;
  font-family: inherit; font-weight: 700;
  background: linear-gradient(90deg, var(--magenta), var(--cyan)); color: #04121a;
}
.share-btn:hover { box-shadow: 0 0 20px rgba(255,45,149,0.35); }
.share-msg { text-align: center; margin-top: 10px; font-size: 0.8rem; color: var(--cyan); font-family: 'IBM Plex Mono', monospace; }

/* Filimo feature card */
.filimo-card {
  display: flex; align-items: center; gap: 20px; margin-top: 40px;
  padding: 16px; border-radius: 18px; text-decoration: none; color: var(--text);
  background: linear-gradient(120deg, rgba(0,240,255,0.08), rgba(255,45,149,0.08)), var(--surface);
  border: 1px solid var(--line); overflow: hidden;
  transition: transform .2s, box-shadow .25s, border-color .2s;
}
.filimo-card:hover {
  transform: translateY(-3px); border-color: rgba(0,240,255,0.5);
  box-shadow: 0 14px 40px rgba(0,0,0,0.5), 0 0 30px rgba(0,240,255,0.18);
}
.filimo-img-wrap {
  flex-shrink: 0; width: 300px; max-width: 46%; border-radius: 12px;
  overflow: hidden; background: var(--surface-2); border: 1px solid var(--line);
}
.filimo-img { display: block; width: 100%; height: auto; }
.filimo-info { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.filimo-caption {
  font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em;
  background: linear-gradient(90deg, var(--cyan), var(--magenta));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.filimo-sub { color: var(--muted); font-size: 0.9rem; }
.filimo-link {
  margin-top: 6px; font-family: 'IBM Plex Mono', monospace; font-size: 0.85rem;
  color: var(--cyan); font-weight: 600;
}
.filimo-card:hover .filimo-link { color: var(--magenta); }
@media (max-width: 560px) {
  .filimo-card { flex-direction: column; text-align: center; }
  .filimo-img-wrap { width: 100%; max-width: 100%; }
  .filimo-info { align-items: center; }
}

/* Footer */
.footer {
  margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line);
  text-align: center; color: var(--muted); font-size: 0.82rem;
}
.remix-link {
  display: inline-block; margin-top: 10px; color: var(--cyan);
  text-decoration: none; font-family: 'IBM Plex Mono', monospace; border-bottom: 1px dashed rgba(0,240,255,0.4);
}
.remix-link:hover { color: var(--magenta); }

/* Responsive */
@media (max-width: 560px) {
  .modal-grid { grid-template-columns: 1fr; }
  .modal-poster { aspect-ratio: 16/9; max-height: 240px; }
  .logo { font-size: 1.5rem; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
}