:root {
  --bg: #0b0f14;
  --bg-soft: #121820;
  --text: #e9edf1;
  --muted: #a6b0bd;
  --primary: #4da3ff;
  --accent: #ff7a59;
  --card: #16202b;
  --border: #203040;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;
  color: var(--text);
  background: var(--bg);
}

.site-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--border); background: var(--bg-soft);
  position: sticky; top: 0; z-index: 100;
}
.branding { display: flex; align-items: center; gap: 10px; }
.logo { font-size: 24px; }
.branding h1 { margin: 0; font-size: 18px; font-weight: 600; }
.controls { display: flex; align-items: center; gap: 16px; }
.search input {
  width: 340px; max-width: 50vw; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--card); color: var(--text);
}
.tabs { display: flex; gap: 6px; }
.tab {
  padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: transparent; color: var(--text); cursor: pointer;
}
.tab.active { background: var(--primary); border-color: var(--primary); color: #001326; }

main { padding: 20px; }

#hero { position: relative; border-radius: 12px; overflow: hidden; background: #0d141d; min-height: 56vh; }
#hero::before { content:""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(90deg, rgba(11,15,20,0.85) 0%, rgba(11,15,20,0.65) 40%, rgba(11,15,20,0.25) 100%); }
.hero-content { position: relative; padding: 28px; max-width: 900px; z-index: 2; display: flex; flex-direction: column; justify-content: flex-end; min-height: 56vh; }
.hero-content h2 { margin: 0 0 10px; font-size: 32px; text-shadow: 0 2px 12px rgba(0,0,0,0.6); }
.hero-content p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.6; }
.hero-meta { margin-top: 10px; font-size: 15px; color: var(--muted); }
.hero-backdrop { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0.55; filter: saturate(1.05) contrast(1.05); }

.section { margin-top: 24px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-actions select { background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; }

.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px;
}
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.25); }
.poster { aspect-ratio: 2/3; background: #0d141d; display: block; width: 100%; object-fit: cover; }
.card-body { padding: 10px; }
.title { font-size: 14px; font-weight: 600; margin: 0 0 6px; }
.meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; }
.rating { color: var(--accent); font-weight: 600; }
.overview { margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.load-more { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px; color: var(--muted); }
.spinner {
  width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--primary);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.55); display: none; align-items: center; justify-content: center; padding: 20px; z-index: 10000; }
.modal[aria-hidden="false"] { display: flex; }
.modal-dialog { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px; max-width: 900px; width: 100%; overflow: hidden; position: relative; z-index: 10001; }
.close { position: absolute; top: 8px; right: 8px; background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; cursor: pointer; }
.modal-content { display: grid; grid-template-columns: 260px 1fr; gap: 16px; padding: 16px; }
.modal-poster { width: 100%; border-radius: 8px; border: 1px solid var(--border); }
.modal-title { margin: 0 0 4px; font-size: 20px; }
.modal-meta { font-size: 14px; color: var(--muted); margin-bottom: 12px; }
.modal-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.tag { background: var(--card); border: 1px solid var(--border); color: var(--muted); padding: 4px 8px; border-radius: 999px; font-size: 12px; }
.modal-overview { color: var(--text); line-height: 1.6; }
.modal-links { margin-top: 12px; }
.modal-links a { color: var(--primary); text-decoration: none; }

.site-footer { padding: 20px; color: var(--muted); border-top: 1px solid var(--border); margin-top: 24px; }
.site-footer a { color: var(--primary); }

/* Ad placeholders */
.ad-slot {
  margin: 12px 20px; border: 1px dashed var(--border); border-radius: 10px; min-height: 80px;
  display: flex; align-items: center; justify-content: center; color: var(--muted); background: rgba(32,48,64,0.15);
}
.ad-sticky {
  position: fixed; left: 0; right: 0; bottom: 0; padding: 8px 12px; backdrop-filter: blur(6px);
  background: rgba(11,15,20,0.65); border-top: 1px solid var(--border); z-index: 10002; min-height: 60px;
}

/* Availability & providers */
.availability { margin-top: 12px; }
.availability .region { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.availability-group { margin-top: 8px; }
.availability-group .group-title { font-size: 13px; color: var(--text); margin-bottom: 6px; }
.provider-logos { display: flex; flex-wrap: wrap; gap: 8px; }
.provider { display: inline-flex; align-items: center; justify-content: center; background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 6px; min-width: 40px; min-height: 32px; }
.provider img { height: 24px; width: auto; display: block; }
.provider span { font-size: 12px; color: var(--muted); padding: 0 6px; }

/* Cookie consent */
.cookie-consent {
  position: fixed; right: 16px; bottom: 80px; display: flex; align-items: center; gap: 10px;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; z-index: 10003;
}
.cookie-consent[hidden] { display: none !important; }
.cookie-consent .cookie-text { font-size: 13px; color: var(--muted); }
.cookie-consent .btn {
  background: var(--primary); color: #001326; border: none; border-radius: 8px; padding: 6px 10px; cursor: pointer;
}

@media (max-width: 760px) {
  .search input { width: 200px; }
  #hero { min-height: 42vh; }
  .hero-content { min-height: 42vh; padding: 20px; }
  .hero-content h2 { font-size: 24px; }
  .modal-content { grid-template-columns: 1fr; }
}
.alert { 
  background: #2a1111; color: #ffb3a6; border: 1px solid #4a1a1a; 
  padding: 10px 12px; border-radius: 8px; margin: 12px 0;
}
/* Standard property for compatibility (not widely supported yet) */
.overview { line-clamp: 3; }