:root {
  --bg: #080b14;
  --bg-2: #0f1424;
  --bg-3: #111a33;
  --border: #1e2a4a;
  --text: #e8ecf5;
  --muted: #8b96b5;
  --accent-1: #4f8cff;
  --accent-2: #a855f7;
  --danger: #ef4444;
  --success: #22c55e;
}

/* ── Base ── */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: radial-gradient(ellipse at top, #0d1220 0%, var(--bg) 60%);
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-1); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ── Auth Pages (Login/Register) ── */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
body.auth-page { min-height: 100vh; display: flex; flex-direction: column; }
body.auth-page .auth-wrap { flex: 1 0 auto; min-height: 0; }
body.auth-page .site-footer { margin-top: auto; }
.auth-card { width: 100%; max-width: 420px; background: linear-gradient(145deg, var(--bg-2), var(--bg-3)); border: 1px solid var(--border); border-radius: 20px; padding: 36px 32px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); }
.logo { font-size: 32px; font-weight: 900; letter-spacing: 4px; text-align: center; background: linear-gradient(90deg, var(--accent-1), var(--accent-2)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.subtitle { text-align: center; color: var(--muted); font-size: 13px; margin: 6px 0 28px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input { width: 100%; padding: 12px 14px; background: #0a0f1c; border: 1px solid var(--border); border-radius: 10px; color: var(--text); font-size: 14px; font-family: inherit; transition: border-color 0.15s; }
.field input:focus { outline: none; border-color: var(--accent-1); }
.btn { width: 100%; padding: 13px 16px; background: linear-gradient(90deg, var(--accent-1), #7c3aed); color: white; border: none; border-radius: 10px; font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit; transition: opacity 0.15s; }
.btn:hover:not(:disabled) { opacity: 0.9; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.alert { padding: 12px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 16px; display: none; }
.alert.show { display: block; }
.alert.error { background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.3); color: #fca5a5; }
.alert.success { background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(34, 197, 94, 0.3); color: #86efac; }
.links { text-align: center; margin-top: 18px; font-size: 13px; color: var(--muted); }
.links a { color: var(--accent-1); }

/* ── Navbar ── */
.site-header { position: sticky; top: 0; z-index: 100; background: rgba(8, 11, 20, 0.85); backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); }
.site-header .container { position: relative; display: flex; align-items: center; gap: 20px; padding-top: 14px; padding-bottom: 14px; }
.site-logo { font-size: 24px; font-weight: 900; letter-spacing: 3px; background: linear-gradient(90deg, var(--accent-1), var(--accent-2)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; text-decoration: none; }
.site-nav { display: flex; gap: 22px; align-items: center; }
.site-nav a { color: var(--muted); font-size: 14px; font-weight: 500; text-decoration: none; transition: color 0.15s; }
.site-nav a:hover, .site-nav a.active { color: var(--text); text-decoration: none; }

/* Navbar Search */
.nav-tools { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; margin-left: auto; }
.nav-search-toggle, .nav-filter-toggle { display: flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.05); color: var(--text); transition: all 0.2s ease; }
.nav-search-toggle { cursor: pointer; }
.nav-filter-toggle { text-decoration: none; }
.nav-search-toggle:hover, .nav-search-toggle:focus-visible, .nav-filter-toggle:hover, .nav-filter-toggle:focus-visible { background: rgba(79, 140, 255, 0.15); color: var(--accent-1); outline: none; text-decoration: none; }
.nav-search-form { position: absolute; z-index: 101; top: calc(100% + 10px); right: 20px; display: none; flex-direction: column; gap: 8px; width: min(340px, calc(100vw - 32px)); padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-2); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45); }
.nav-search-form:not([hidden]) { display: flex; }
.nav-search-input-row { display: flex; gap: 8px; }
.nav-search-form input { flex: 1; min-width: 0; height: 42px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; background: #0a0f1c; color: var(--text); font: inherit; }
.nav-search-form input:focus { outline: none; border-color: var(--accent-1); }
.nav-search-form button { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; gap: 8px; min-width: 92px; height: 42px; padding: 0 12px; border: 0; border-radius: 8px; background: linear-gradient(90deg, var(--accent-1), #7c3aed); color: #fff; font: inherit; font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.nav-search-form button svg { flex: 0 0 18px; width: 18px; height: 18px; }
.nav-search-results { display: grid; gap: 4px; max-height: min(50vh, 320px); overflow-y: auto; scrollbar-color: var(--border) transparent; }
.nav-search-results[hidden] { display: none; }
.nav-search-result { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 7px; border-radius: 9px; color: var(--text); text-decoration: none; transition: background 0.15s ease; }
.nav-search-result:hover, .nav-search-result:focus-visible { background: rgba(79, 140, 255, 0.12); outline: none; text-decoration: none; }
.nav-search-result img { flex: 0 0 36px; width: 36px; height: 52px; border: 1px solid rgba(139, 150, 181, 0.16); border-radius: 5px; background: #0a0f1c; object-fit: cover; }
.nav-search-result-copy { display: grid; gap: 3px; min-width: 0; }
.nav-search-result-copy strong { overflow: hidden; font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.nav-search-result-copy span, .nav-search-message { color: var(--muted); font-size: 12px; }
.nav-search-message { padding: 9px 7px; }
.nav-search-advanced { align-self: flex-start; color: var(--muted); font-size: 12px; }
.nav-search-advanced:hover { color: var(--text); }

.nav-auth { display: flex; gap: 10px; align-items: center; }
.nav-login { color: var(--text); font-size: 14px; padding: 8px 14px; text-decoration: none; }
.btn-nav, .btn-nav-outline { padding: 9px 18px; border-radius: 8px; font-size: 14px; font-weight: 600; text-decoration: none; display: inline-block; }
.btn-nav { background: linear-gradient(90deg, var(--accent-1), #7c3aed); color: #fff; }
.btn-nav-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.nav-user { color: var(--accent-1); font-size: 14px; font-weight: 600; text-decoration: none; padding: 6px 10px; }

/* ── Hero Slider ── */
.hero { position: relative; width: 100%; height: 500px; overflow: hidden; border-bottom: 1px solid var(--border); background: #000; }
.hero-slider { display: flex; width: 100%; height: 100%; transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1); }
.hero-slide { flex: 0 0 100%; width: 100%; height: 100%; position: relative; display: flex; align-items: flex-end; }
.hero-slide .hero-bg { position: absolute; inset: 0; background-size: cover; background-position: center 20%; }
.hero-slide .hero-bg::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, var(--bg) 0%, transparent 50%), linear-gradient(to right, rgba(8,11,20,0.95) 0%, rgba(8,11,20,0.3) 60%, transparent 100%); }
.hero-slide .container { position: relative; z-index: 2; width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 20px 50px 20px; }
.hero-content { display: flex; flex-direction: column; align-items: flex-start; text-align: left; max-width: 600px; }
.hero-content h1 { font-size: clamp(24px, 3vw, 36px); font-weight: 800; line-height: 1.2; margin-bottom: 12px; text-shadow: 0 2px 10px rgba(0,0,0,0.8); color: #fff; }
.hero-meta { display: flex; gap: 12px; align-items: center; color: var(--muted); font-size: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.hero-overview { color: #c5cde0; font-size: 14px; line-height: 1.5; margin-bottom: 24px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hero-actions { display: flex; gap: 12px; }
.btn-hero { padding: 10px 24px; font-size: 14px; border-radius: 8px; font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; transition: opacity 0.15s; }
.btn-hero-primary { background: linear-gradient(90deg, var(--accent-1), #7c3aed); color: #fff; }
.btn-hero-secondary { background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.15); color: var(--text); }
.btn-hero:hover { opacity: 0.9; text-decoration: none; }

/* ── Sections & Rows ── */
.section { padding: 40px 0 10px; }
.section-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 18px; }
.section-header h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.view-all-link { font-size: 13px; font-weight: 600; color: var(--accent-1); text-decoration: none; padding: 6px 12px; border-radius: 6px; background: rgba(79, 140, 255, 0.1); transition: all 0.15s; }
.view-all-link:hover { background: rgba(79, 140, 255, 0.2); text-decoration: none; }

.row-scroll { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
.row-scroll::-webkit-scrollbar { height: 6px; }
.row-scroll::-webkit-scrollbar-track { background: transparent; }
.row-scroll::-webkit-scrollbar-thumb { background: #1e2a4a; border-radius: 3px; }

/* ── Homepage discovery layout ── */
.container.home-layout { max-width: 1440px; }
.home-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); grid-template-areas: "filters hero" "content content"; gap: 0 28px; align-items: start; }
.home-hero { grid-area: hero; }
.home-filters { grid-area: filters; padding: 20px; border: 1px solid var(--border); border-radius: 16px; background: linear-gradient(145deg, rgba(15,20,36,0.96), rgba(17,26,51,0.88)); box-shadow: 0 14px 36px rgba(0,0,0,0.2); }
.home-filter-heading { margin-bottom: 8px; }
.home-filter-kicker { color: var(--accent-1); font-size: 10px; font-weight: 800; letter-spacing: 0.14em; }
.home-filter-heading h2 { margin-top: 4px; font-size: 18px; line-height: 1.3; }
.home-filter-description { margin-bottom: 20px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.home-filter-controls { display: grid; gap: 20px; }
.home-filter-field { display: flex; flex-direction: column; gap: 6px; }
.home-filter-field h3 { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.04em; }
.home-filter-options { display: flex; flex-wrap: wrap; gap: 7px; }
.home-filter-option { padding: 6px 9px; border: 1px solid var(--border); border-radius: 999px; background: rgba(8,11,20,0.55); color: var(--muted); font: inherit; font-size: 11px; font-weight: 600; line-height: 1.25; white-space: nowrap; cursor: pointer; transition: color 0.15s, border-color 0.15s, background 0.15s; }
.home-filter-option:hover { border-color: var(--accent-1); color: var(--text); }
.home-filter-option[aria-pressed="true"] { border-color: var(--accent-1); background: rgba(79,140,255,0.18); color: #dbeafe; }
.home-filter-option:focus-visible { outline: 2px solid var(--accent-1); outline-offset: 2px; }
.home-filter-field select { width: 100%; padding: 11px 34px 11px 12px; appearance: none; border: 1px solid var(--border); border-radius: 9px; background: var(--bg-2) url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%238b96b5%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E") no-repeat right 12px center / 9px auto; color: var(--text); font: inherit; font-size: 13px; }
.home-filter-field select:focus { outline: none; border-color: var(--accent-1); box-shadow: 0 0 0 3px rgba(79,140,255,0.12); }
.home-filter-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.home-filter-clear { padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; background: rgba(79,140,255,0.12); color: var(--text); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; transition: background 0.15s, border-color 0.15s; }
.home-filter-clear:hover:not(:disabled) { border-color: var(--accent-1); background: rgba(79,140,255,0.2); }
.home-filter-clear:disabled { opacity: 0.5; cursor: default; }
.home-filter-advanced { color: var(--muted); font-size: 12px; text-align: center; }
.home-your-space { margin-top: 22px; padding-top: 18px; border-top: 1px solid rgba(139,150,181,0.18); }
.home-your-space[hidden] { display: none; }
.home-your-space-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }
.home-space-welcome { margin-top: 5px; color: var(--muted); font-size: 11px; }
.home-space-dashboard { color: var(--accent-1); font-size: 11px; font-weight: 700; white-space: nowrap; }
.home-space-dashboard[hidden] { display: none; }
.home-space-content { display: grid; gap: 14px; }
.home-space-guest { display: grid; gap: 10px; padding: 12px; border: 1px solid rgba(79,140,255,0.18); border-radius: 10px; background: rgba(79,140,255,0.06); }
.home-space-guest p { color: #c5cde0; font-size: 11px; line-height: 1.5; }
.home-space-auth-links { display: flex; align-items: center; gap: 8px; }
.home-space-auth-links a { padding: 7px 10px; border-radius: 7px; font-size: 11px; font-weight: 700; text-decoration: none; }
.home-space-signin { background: linear-gradient(90deg, var(--accent-1), #7c3aed); color: #fff; }
.home-space-register { border: 1px solid var(--border); color: var(--text); }
.home-space-group { display: grid; gap: 8px; }
.home-space-group-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.home-space-group-heading h3 { min-width: 0; margin: 0; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.04em; }
.home-space-count { flex: 0 0 auto; padding: 3px 7px; border: 1px solid rgba(139,150,181,0.14); border-radius: 999px; background: rgba(139,150,181,0.07); color: #8b96b5; font-size: 10px; white-space: nowrap; }
.home-space-group-footer { margin-top: 1px; }
.home-space-more { display: flex; align-items: center; justify-content: center; gap: 5px; width: 100%; padding: 7px 10px; border: 1px solid rgba(79,140,255,0.2); border-radius: 8px; background: rgba(79,140,255,0.07); color: var(--accent-1); font-size: 11px; font-weight: 700; text-decoration: none; transition: background 0.15s, border-color 0.15s; }
.home-space-more:hover { border-color: rgba(79,140,255,0.4); background: rgba(79,140,255,0.14); color: #fff; text-decoration: none; }
.home-space-list { display: grid; gap: 7px; }
.home-space-item { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 6px; border: 1px solid rgba(139,150,181,0.12); border-radius: 9px; background: rgba(8,11,20,0.35); }
.home-space-item-main { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; color: var(--text); text-decoration: none; }
.home-space-item-main:hover { color: #fff; text-decoration: none; }
.home-space-poster { display: grid; place-items: center; flex: 0 0 34px; width: 34px; height: 50px; overflow: hidden; border: 1px solid rgba(139,150,181,0.16); border-radius: 5px; background: #0a0f1c; color: var(--accent-1); font-size: 12px; }
.home-space-poster img { width: 100%; height: 100%; object-fit: cover; }
.home-space-copy { display: grid; gap: 3px; min-width: 0; }
.home-space-copy strong { overflow: hidden; font-size: 11px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.home-space-copy small { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.home-space-progress { height: 3px; overflow: hidden; border-radius: 999px; background: rgba(139,150,181,0.2); }
.home-space-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent-1), var(--accent-2)); }
.home-space-action { flex: 0 0 auto; padding: 6px 7px; border-radius: 6px; background: rgba(79,140,255,0.12); color: #bcd4ff; font-size: 10px; font-weight: 700; text-decoration: none; }
.home-space-action:hover { background: rgba(79,140,255,0.2); color: #fff; text-decoration: none; }
.home-space-empty, .home-space-error { color: var(--muted); font-size: 11px; line-height: 1.5; }
.home-space-error { color: #fca5a5; }
.home-filtered-results { padding: 40px 0 10px; }
.home-filtered-results[hidden] { display: none; }
.home-filtered-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.home-filtered-heading h2 { font-size: 22px; font-weight: 700; }
.home-filter-results { color: var(--muted); font-size: 12px; text-align: right; }
.home-filtered-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 20px 14px; }
.home-filtered-grid .movie-card { min-width: 0; }
.home-filter-empty { margin: 20px 0; padding: 24px; border: 1px dashed var(--border); border-radius: 12px; color: var(--muted); text-align: center; }
.home-filter-empty[hidden] { display: none; }
.home-filter-error { margin: 20px 0; padding: 14px; border: 1px solid rgba(239,68,68,0.3); border-radius: 10px; color: var(--danger); text-align: center; }
.home-filter-error[hidden] { display: none; }
.home-content { grid-area: content; min-width: 0; }
.home-content > .row-section[hidden] { display: none; }

@media screen and (min-width: 769px) {
  .site-header .container { max-width: 1440px; }
  .home-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "hero" "filters" "content"; gap: 0; }
  .home-filters { display: grid; gap: 12px; margin-top: 24px; padding: 24px; border-color: rgba(139,150,181,0.2); border-radius: 18px; background: linear-gradient(155deg, rgba(18,25,45,0.98), rgba(11,15,28,0.96)); box-shadow: 0 18px 48px rgba(0,0,0,0.24); }
  .home-filter-heading { display: flex; align-items: baseline; gap: 12px; margin-bottom: 0; }
  .home-filter-heading h2 { margin: 0; font-size: 19px; letter-spacing: -0.02em; }
  .home-filter-description { margin: 0; line-height: 1.6; }
  .home-filter-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
  .home-filter-field + .home-filter-field { padding-left: 24px; border-top: 0; border-left: 1px solid rgba(139,150,181,0.16); }
  .home-filter-option { padding: 7px 10px; border-color: rgba(139,150,181,0.18); background: rgba(255,255,255,0.035); font-size: 12px; }
  .home-filter-option:hover { transform: translateY(-1px); }
  .home-filter-option[aria-pressed="true"] { box-shadow: 0 3px 12px rgba(79,140,255,0.16); }
  .home-filter-actions { flex-direction: row; align-items: center; justify-content: space-between; margin-top: 0; }
  .home-filter-advanced { text-align: right; }

  .home-hero { height: clamp(400px, 35vw, 480px); border: 1px solid rgba(139,150,181,0.18); border-bottom: 1px solid rgba(139,150,181,0.18); border-radius: 20px; background: #0c1222; box-shadow: 0 20px 56px rgba(0,0,0,0.28); }
  .home-hero .hero-slide .container { max-width: none; padding: 0 42px 38px; }
  .home-hero .hero-content { max-width: 560px; }
  .home-hero .hero-content h1 { font-size: clamp(28px, 2.7vw, 38px); letter-spacing: -0.03em; }
  .home-hero .hero-meta { margin-bottom: 14px; }
  .home-hero .hero-meta .rating { padding: 4px 8px; border: 1px solid rgba(251,191,36,0.18); border-radius: 999px; background: rgba(251,191,36,0.1); }
  .home-hero .hero-overview { max-width: 500px; margin-bottom: 20px; }
  .home-hero .hero-bg-empty { background: radial-gradient(ellipse at 78% 24%, rgba(79,140,255,0.24), transparent 34%), radial-gradient(ellipse at 62% 78%, rgba(168,85,247,0.2), transparent 40%), linear-gradient(125deg, #18213c, #0b1020 64%, #171126); }

  .home-content > .row-section { padding-top: 34px; }
  .home-content .section-header { margin-bottom: 16px; }
  .home-content .section-header h2 { font-size: 23px; letter-spacing: -0.02em; }
  .home-content .row-scroll { gap: 16px; }
  .home-content .row-scroll .movie-card { width: 172px; }
  .home-content .card-poster { border-radius: 13px; transition: border-color 0.18s, box-shadow 0.18s; }
  .home-content .movie-card:hover .card-poster { border-color: rgba(79,140,255,0.65); box-shadow: 0 12px 28px rgba(0,0,0,0.32); }
  .home-content .card-body { padding-top: 11px; }
}

@media screen and (min-width: 769px) {
  .home-layout.has-active-filters { grid-template-areas: "filters" "content"; }
  .home-layout.has-active-filters .home-hero { display: none !important; }
}

@media screen and (min-width: 769px) and (max-width: 1100px) {
  .home-hero { height: clamp(360px, 40vw, 430px); }
  .home-hero .hero-slide .container { padding: 0 30px 32px; }
}

@media screen and (min-width: 900px) {
  .home-layout { grid-template-columns: clamp(250px, 22vw, 300px) minmax(0, 1fr); grid-template-areas: "filters hero" "filters content"; gap: 0 16px; }
  .home-layout.has-active-filters { grid-template-areas: "filters content"; }
  .home-filters { display: block; align-self: stretch; margin-top: 0; padding: 24px 20px; }
  .home-filter-heading { display: block; margin-bottom: 8px; }
  .home-filter-heading h2 { margin-top: 4px; font-size: 19px; letter-spacing: -0.02em; }
  .home-filter-description { margin-bottom: 20px; line-height: 1.55; }
  .home-filter-controls { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .home-filter-field + .home-filter-field { padding-top: 16px; padding-left: 0; border-top: 1px solid rgba(139,150,181,0.16); border-left: 0; }
  .home-filter-actions { flex-direction: column; align-items: stretch; gap: 10px; margin-top: 18px; }
  .home-filter-advanced { text-align: center; }
  .home-hero { height: clamp(400px, 33vw, 460px); }
}

/* ── Movie Card (Base) ── */
.movie-card { color: inherit; text-decoration: none; transition: transform 0.18s; display: block; }
.movie-card:hover { transform: translateY(-4px); text-decoration: none; }

/* Row එකේ තියෙන කාඩ්පත් වලට විතරක් size එක දෙනවා */
.row-scroll .movie-card { flex: 0 0 auto; width: 165px; scroll-snap-align: start; }

.card-poster { position: relative; aspect-ratio: 2 / 3; border-radius: 10px; overflow: hidden; background: #0a0f1c; border: 1px solid var(--border); width: 100%; }
.card-poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-badge { position: absolute; top: 8px; left: 8px; background: rgba(124, 58, 237, 0.9); color: #fff; font-size: 10px; font-weight: 700; padding: 3px 7px; border-radius: 4px; letter-spacing: 0.5px; }
.card-badge-mini { background: rgba(14, 116, 144, 0.95); font-size: 9px; white-space: nowrap; }
.card-overlay { position: absolute; inset: 0; display: flex; align-items: flex-end; padding: 8px; background: linear-gradient(to top, rgba(0,0,0,0.75), transparent 50%); opacity: 0; transition: opacity 0.15s; }
.movie-card:hover .card-overlay { opacity: 1; }
.card-rating { font-size: 12px; font-weight: 600; color: #fbbf24; }
.card-body { padding: 10px 2px 0; }
.card-title { font-size: 14px; font-weight: 600; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.card-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* ── Grid Layouts (Browse / Search) ── */
.results-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 20px; padding: 30px 0; width: 100%; }
.results-grid .movie-card { width: 100% !important; max-width: 100% !important; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 8px 0 40px; }
.pagination[hidden] { display: none; }
.pagination-link { padding: 9px 16px; border: 1px solid var(--border); border-radius: 8px; color: var(--text); background: var(--bg-2); font-size: 14px; font-weight: 600; text-decoration: none; }
.pagination-link:hover:not(.disabled) { border-color: var(--accent-1); color: var(--accent-1); text-decoration: none; }
.pagination-link.disabled { opacity: 0.45; cursor: not-allowed; }
.pagination-status { color: var(--muted); font-size: 13px; white-space: nowrap; }

/* ── Search Page ── */
.search-page-wrap { padding: 40px 20px; max-width: 1000px; margin: 0 auto; }
.search-header { text-align: center; margin-bottom: 30px; }
.search-header h1 { font-size: 32px; font-weight: 800; background: linear-gradient(90deg, var(--accent-1), var(--accent-2)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin-bottom: 8px; }
.search-header p { color: var(--muted); font-size: 14px; }
.search-bar-row { display: flex; gap: 10px; margin-bottom: 20px; }
.search-input-wrap { position: relative; flex: 1; }
.search-input-wrap svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-input-wrap input { width: 100%; padding: 14px 16px 14px 48px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; color: var(--text); font-size: 15px; font-family: inherit; }
.search-input-wrap input:focus { outline: none; border-color: var(--accent-1); box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.15); }
.btn-main-search { padding: 0 32px; background: linear-gradient(90deg, var(--accent-1), #7c3aed); color: #fff; border: none; border-radius: 12px; font-weight: 600; font-size: 15px; cursor: pointer; font-family: inherit; white-space: nowrap; }
.filters-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 40px; }
.filter-box { display: flex; flex-direction: column; gap: 6px; }
.filter-box label { font-size: 12px; font-weight: 600; color: var(--muted); padding-left: 4px; }
.filter-box select, .filter-box input { width: 100%; padding: 12px 14px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; color: var(--text); font-size: 14px; font-family: inherit; appearance: none; }
.filter-box select { background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%238b96b5%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E"); background-repeat: no-repeat; background-position: right 14px top 50%; background-size: 10px auto; padding-right: 40px; }
.filter-box input:focus, .filter-box select:focus { outline: none; border-color: var(--accent-1); }

/* ── Empty State ── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state h3 { font-size: 18px; color: var(--text); margin-bottom: 6px; }

/* ── Shared Page Loader ── */
.details-page-loader { position: fixed; z-index: 10000; inset: 0; display: grid; place-items: center; padding: 24px; background: radial-gradient(ellipse at 50% 42%, rgba(91, 75, 165, 0.24), transparent 40%), radial-gradient(ellipse at 15% 100%, rgba(42, 91, 176, 0.13), transparent 38%), #080a10; opacity: 1; visibility: visible; transition: opacity 0.35s ease, visibility 0.35s ease; }
.details-page-loader.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.details-loader-card { width: min(390px, 100%); padding: 30px 28px 25px; border: 1px solid rgba(255, 255, 255, 0.11); border-radius: 22px; background: linear-gradient(145deg, rgba(24, 26, 40, 0.88), rgba(12, 14, 23, 0.88)); box-shadow: 0 30px 90px rgba(0, 0, 0, 0.42), 0 0 55px rgba(139, 92, 246, 0.08); text-align: center; backdrop-filter: blur(18px); }
.details-loader-logo { display: inline-block; margin-bottom: 27px; }
.details-loader-spinner { position: relative; width: 58px; height: 58px; margin: 0 auto 21px; border: 2px solid rgba(255, 255, 255, 0.09); border-top-color: #a78bfa; border-right-color: #6ea3ff; border-radius: 50%; animation: details-loader-spin 0.9s linear infinite; }
.details-loader-spinner::after { position: absolute; inset: 8px; border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 50%; content: ""; }
.details-loader-title { margin: 0; color: #fff; font-size: 17px; font-weight: 750; letter-spacing: -0.2px; }
.details-loader-message { margin: 8px 0 20px; color: rgba(226, 228, 239, 0.58); font-size: 12px; line-height: 1.6; }
.details-loader-progress { height: 3px; overflow: hidden; border-radius: 999px; background: rgba(255, 255, 255, 0.09); }
.details-loader-progress::after { display: block; width: 38%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #8b5cf6, #6ea3ff); box-shadow: 0 0 14px rgba(139, 92, 246, 0.55); content: ""; animation: details-loader-progress 1.5s ease-in-out infinite; }
@keyframes details-loader-spin { to { transform: rotate(360deg); } }
@keyframes details-loader-progress { from { transform: translateX(-110%); } to { transform: translateX(280%); } }
@media (prefers-reduced-motion: reduce) {
  .details-loader-spinner, .details-loader-progress::after { animation: none; }
}

/* ── Details Page ── */
.details-hero { position: relative; min-height: 420px; overflow: hidden; border-bottom: 1px solid var(--border); }
.details-backdrop { position: absolute; inset: 0; background-size: cover; background-position: center 30%; filter: brightness(0.4); }
.details-backdrop::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, var(--bg) 10%, transparent 70%); }
.details-content { position: relative; z-index: 2; display: grid; grid-template-columns: 220px 1fr; gap: 32px; padding: 60px 20px 40px; align-items: end; }
.details-poster { border-radius: 12px; overflow: hidden; border: 1px solid var(--border); aspect-ratio: 2 / 3; background: #0a0f1c; }
.details-poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.details-info h1 { font-size: clamp(26px, 4vw, 40px); font-weight: 800; line-height: 1.15; margin-bottom: 12px; }
.details-meta { display: flex; gap: 14px; color: var(--muted); font-size: 14px; margin-bottom: 18px; flex-wrap: wrap; align-items: center; }
.details-meta .rating { color: #fbbf24; font-weight: 600; }
.series-type-note { display: inline-flex; align-items: center; padding: 3px 8px; border: 1px solid rgba(56, 189, 248, 0.35); border-radius: 999px; background: rgba(14, 116, 144, 0.18); color: #7dd3fc; font-size: 10px; font-weight: 800; letter-spacing: 0.06em; white-space: nowrap; }
.details-overview { color: #c5cde0; font-size: 15px; line-height: 1.65; max-width: 780px; margin-bottom: 20px; }
.details-genres { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.genre-chip { padding: 6px 12px; background: rgba(79, 140, 255, 0.12); border: 1px solid rgba(79, 140, 255, 0.3); border-radius: 999px; color: #93c5fd; font-size: 12px; font-weight: 500; }
.details-section { padding: 36px 0; border-bottom: 1px solid var(--border); }
.details-section:last-child { border-bottom: none; }
.details-section h2 { font-size: 20px; font-weight: 700; margin-bottom: 20px; }

/* Cast Row */
.cast-grid { display: flex; gap: 16px; overflow-x: auto; padding: 2px 2px 12px; scroll-snap-type: x mandatory; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.cast-card { flex: 0 0 135px; min-width: 0; text-align: center; font-size: 13px; scroll-snap-align: start; }
.cast-carousel { display: flex !important; flex-direction: row !important; flex-wrap: nowrap !important; gap: 12px; width: 100%; max-width: 100%; overflow-x: auto !important; overflow-y: hidden !important; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.cast-carousel > .cast-card { display: block !important; flex: 0 0 135px !important; width: 135px !important; max-width: none !important; }
.cast-photo { width: 100%; aspect-ratio: 2/3; border-radius: 10px; object-fit: cover; background: #0a0f1c; border: 1px solid var(--border); margin-bottom: 8px; display: block; }
.cast-name { color: var(--text); font-weight: 600; margin-bottom: 2px; }
.cast-role { color: var(--muted); font-size: 12px; }

/* Trailer */
.trailer-wrap { position: relative; width: 100%; max-width: 900px; aspect-ratio: 16/9; border-radius: 12px; overflow: hidden; background: #000; border: 1px solid var(--border); }
.trailer-wrap iframe { width: 100%; height: 100%; border: 0; }

/* Seasons & Episodes */
.season-tabs { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 20px; padding-bottom: 6px; }
.season-tab { padding: 9px 18px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; color: var(--muted); font-size: 14px; cursor: pointer; font-family: inherit; white-space: nowrap; }
.season-tab.active { background: rgba(79, 140, 255, 0.12); border-color: var(--accent-1); color: var(--accent-1); font-weight: 600; }
.episode-list { display: grid; gap: 12px; }
.episode-item { display: grid; grid-template-columns: 180px 1fr; gap: 16px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; align-items: center; padding: 10px; }
.episode-thumb { width: 100%; aspect-ratio: 16/9; border-radius: 6px; object-fit: cover; background: #0a0f1c; }
.episode-body { padding-right: 8px; }
.episode-num { font-size: 13px; color: var(--accent-1); font-weight: 600; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 4px; }
.episode-title { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.episode-overview { font-size: 13px; color: var(--muted); line-height: 1.5; max-height: 3em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.episode-item { color: var(--text); cursor: pointer; text-decoration: none; transition: border-color 0.2s ease; }
.episode-item:hover { border-color: var(--accent-1); text-decoration: none; }
.episode-item:focus-visible { outline: 2px solid var(--accent-1); outline-offset: 3px; }

.episode-detail-shell { padding: 40px 0; }
.episode-detail-shell .container { max-width: 920px; }
.episode-detail-grid { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); align-items: center; gap: 28px; }
.episode-detail-image-wrap { width: 100%; max-width: 300px; justify-self: center; overflow: hidden; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-2); }
.episode-detail-image { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.episode-detail-info { padding: 24px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-2); }
.episode-detail-series { margin-bottom: 8px; color: var(--accent-1); font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.episode-detail-title { margin-bottom: 14px; font-size: clamp(24px, 3vw, 34px); font-weight: 800; line-height: 1.15; }
.episode-detail-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; color: var(--muted); font-size: 12px; }
.episode-detail-meta span { padding: 6px 9px; border: 1px solid var(--border); border-radius: 999px; background: rgba(255, 255, 255, 0.03); }
.episode-detail-overview { max-width: 700px; color: #c5cde0; font-size: 14px; line-height: 1.7; }
.episode-detail-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 20px; }
.episode-unavailable { color: var(--muted); font-size: 13px; }
.episode-detail-next-row { display: flex; justify-content: flex-end; margin-top: 24px; }
.episode-next-button { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; color: var(--muted); background: var(--bg-2); font-size: 12px; font-weight: 600; text-decoration: none; transition: border-color 0.2s ease, color 0.2s ease; }
.episode-next-button:hover { border-color: var(--accent-1); color: var(--text); text-decoration: none; }

/* Clean Action Buttons (Watchlist / Favorite) */
.action-btn { display: inline-flex; align-items: center; gap: 8px; background: transparent; border: none; color: var(--muted); font-size: 14px; font-weight: 600; cursor: pointer; padding: 0; transition: all 0.2s ease; font-family: inherit; }
.action-btn:hover { color: var(--text); }
.action-btn.active { color: var(--accent-1); }
.action-btn.active svg { stroke: var(--accent-1); fill: rgba(79, 140, 255, 0.2); }
.action-btn.fav-btn.active { color: #ef4444; }
.action-btn.fav-btn.active svg { stroke: #ef4444; fill: rgba(239, 68, 68, 0.2); }

/* ── Footer ── */
.site-footer { margin-top: 60px; padding: 36px 0 28px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.site-footer .container { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; margin-bottom: 24px; }
.site-footer .container.footer-main { grid-template-columns: 2fr repeat(4, minmax(0, 1fr)); }
.site-footer .container > .footer-bottom { grid-column: 1 / -1; }
.site-footer h4 { color: var(--text); font-size: 14px; margin-bottom: 12px; }
.site-footer a { display: block; color: var(--muted); text-decoration: none; padding: 4px 0; font-size: 13px; }
.site-footer a:hover { color: var(--text); }
.footer-bottom { padding-top: 20px; border-top: 1px solid var(--border); font-size: 12px; color: #5a6484; text-align: center; line-height: 1.7; }
.pwa-install-notice { position: fixed; z-index: 10000; right: 20px; bottom: 20px; width: min(360px, calc(100vw - 32px)); padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-2); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5); }
.pwa-install-title { display: block; font-size: 16px; }
.pwa-install-message { margin-top: 6px; color: var(--muted); font-size: 13px; }
.pwa-install-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.pwa-install-actions button { padding: 7px 12px; border: 1px solid var(--border); border-radius: 8px; font: inherit; font-size: 12px; cursor: pointer; }
.pwa-install-primary { background: var(--accent-1); color: #fff; }
.pwa-install-dismiss { background: transparent; color: var(--text); }
.pwa-install-actions button:disabled { opacity: 0.6; cursor: wait; }
.tmdb-attribution { display: inline-flex; align-items: center; gap: 8px; color: #8b96b5; }
.tmdb-attribution strong { color: #01b4e4; }

/* ═══════════════════════════════════════════════
   MOBILE SPECIFIC STYLES (Fixes all mobile issues)
   ═══════════════════════════════════════════════ */
@media screen and (max-width: 768px) {
  .home-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "hero" "content"; gap: 0; }
  .home-hero { width: calc(100% + 16px); margin-left: -8px; border: 1px solid rgba(139,150,181,0.24); border-radius: 14px; box-shadow: 0 10px 28px rgba(0,0,0,0.24); }
  .home-filters { display: none; }
  .home-content > .row-section:first-child { padding-top: 40px; }
  .home-filtered-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }

  /* Navbar */
  .site-nav { display: none; }
  .site-header .container { gap: 10px; }
  
  .nav-tools { gap: 6px; }
  .nav-search-toggle, .nav-filter-toggle { width: 36px; height: 36px; }
  
  .nav-auth { 
    margin-left: 0 !important; 
    gap: 8px; 
  }
  .nav-login { padding: 6px 10px; font-size: 13px; }
  .btn-nav { padding: 7px 14px; font-size: 13px; }

  /* Hero Slider */
  .hero { height: clamp(180px, 56.25vw, 430px); min-height: 180px; }
  .hero-slide .hero-bg {
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
  }
  .hero-slide .hero-bg.hero-bg-poster { background-position: center; }
  .hero-slide .hero-bg::after {
    background: linear-gradient(to bottom, rgba(8,11,20,0) 0%, rgba(8,11,20,0.1) 30%, rgba(8,11,20,0.88) 65%, rgba(8,11,20,0.96) 100%);
  }
  .hero-slide .container {
    display: flex;
    align-items: flex-end;
    height: 100%;
    padding: 0 16px 10px;
  }
  .hero-content { width: 100%; max-width: none; }
  .hero-content h1 { font-size: clamp(17px, 4.8vw, 22px); line-height: 1.15; margin-bottom: 4px; }
  .hero-meta { gap: 8px; font-size: 12px; margin-bottom: 5px; }
  .hero-overview { -webkit-line-clamp: 2; font-size: 12px; line-height: 1.3; margin-bottom: 7px; }
  .btn-hero { padding: 7px 12px; font-size: 13px; }

  /* Homepage Rows */
  .row-scroll .movie-card { width: 130px; }
  #r-movies .movie-card:nth-child(n + 7),
  #r-series .movie-card:nth-child(n + 7) { display: none; }

  /* Browse / Search GRID (මේක තමයි අලුතින් හදලා තියෙන්නේ) */
  .results-grid { 
    display: grid !important;
    /* minmax(0, 1fr) මේක තමයි දිග අකුරු නිසා grid එක කැඩෙන එක නවත්තන්නේ */
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 12px !important; 
    padding: 15px 0 !important;
    width: 100% !important;
    margin: 0 !important;
  }
  
  .results-grid .movie-card { 
    display: block !important;
    width: 100% !important; 
    max-width: 100% !important; 
    min-width: 0 !important; 
    margin: 0 !important;
  }
  
  .results-grid .card-poster {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 2 / 3 !important;
  }

  /* Search Page Filters */
  .search-page-wrap { padding: 24px 16px; }
  .search-header h1 { font-size: 26px; }
  .search-bar-row { flex-direction: column; gap: 12px; }
  .btn-main-search { padding: 14px 32px; width: 100%; }
  .filters-grid { grid-template-columns: 1fr 1fr; gap: 12px; }

  /* Details Page */
  .details-content { grid-template-columns: 1fr; padding: 40px 16px 30px; }
  .details-poster { max-width: 160px; margin: 0 auto; }
  .episode-item { grid-template-columns: 1fr; }
  .episode-detail-shell { padding: 28px 0; }
  .episode-detail-grid { grid-template-columns: minmax(0, 260px) minmax(0, 1fr); gap: 20px; }
  .episode-detail-image-wrap { max-width: 260px; }
  .episode-detail-info { padding: 18px; }
  
  /* Footer */
  .site-footer .container { grid-template-columns: 1fr; gap: 20px; }
  .site-footer .container.footer-main { grid-template-columns: 1fr; }
}

@media screen and (max-width: 560px) {
  .site-footer { margin-top: 40px; padding: 28px 0 22px; }
  .site-footer .container { padding-right: 16px; padding-left: 16px; }
  .footer-bottom { padding-top: 16px; }
  .episode-detail-grid { grid-template-columns: 1fr; gap: 18px; }
  .episode-detail-image-wrap { max-width: 300px; }
}

/* ═══════════════════════════════════════════════
   MOBILE SPECIFIC STYLES (Clean Navbar Fix)
   ═══════════════════════════════════════════════ */
@media screen and (max-width: 768px) {
  /* Navbar (Single Row) */
  .site-header .container { 
    flex-wrap: nowrap !important; /* බලෙන්ම එක පේළියක තියන්න */
    gap: 6px !important; 
    padding-top: 10px !important;
    padding-bottom: 10px !important;
  }

  /* ලෝගෝ එකයි Home එකයි අතර ඉඩ තැබීම (මේකයි අලුතින් කළේ) */
  .site-logo { 
    font-size: 18px !important; 
    letter-spacing: 1px !important;
    margin-right: 12px !important; /* ලෝගෝ එකට පස්සේ 12px ඉඩක් */
  }
  
  /* ලින්ක්ස් ටික එක පේළියට ගන්නවා */
  .site-nav { 
    display: flex !important; 
    order: 0 !important; 
    width: auto !important; 
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    gap: 10px !important; /* Home, Movies, TV Series අතර ඉඩ */
  }
  
  .site-nav a { 
    font-size: 12px !important; 
    white-space: nowrap !important; 
  }

  .nav-tools { gap: 4px !important; margin-left: auto !important; }
  .nav-search-toggle, .nav-filter-toggle {
    width: 30px !important;
    height: 30px !important;
    margin: 0 !important;
  }
  
  .nav-search-toggle svg {
    width: 16px !important;
    height: 16px !important;
  }
  
  /* Sign up බටන් එක / Admin බටන් එක පොඩි කළා */
  .nav-auth { 
    margin-left: 0 !important; 
    gap: 6px !important; 
  }

  .nav-search-form { right: 16px; }
  
  .nav-login { display: none !important; } 
  
  .btn-nav, .btn-nav-outline { 
    padding: 6px 10px !important; 
    font-size: 12px !important; 
    white-space: nowrap !important;
  }
  
  .nav-user {
    font-size: 12px !important;
    padding: 4px 6px !important;
  }

  /* Hero Slider */
  .hero { height: clamp(180px, 56.25vw, 430px); min-height: 180px; }

  /* Homepage Rows */
  .row-scroll .movie-card { width: 130px; }

  /* Browse / Search GRID */
  .results-grid { 
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 12px !important; 
    padding: 15px 0 !important;
    width: 100% !important;
    margin: 0 !important;
  }
  
  .results-grid .movie-card { 
    display: block !important;
    width: 100% !important; 
    max-width: 100% !important; 
    min-width: 0 !important; 
    margin: 0 !important;
  }
  
  .results-grid .card-poster {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 2 / 3 !important;
  }

  /* Search Page Filters */
  .search-page-wrap { padding: 24px 16px; }
  .search-header h1 { font-size: 26px; }
  .search-bar-row { flex-direction: column; gap: 12px; }
  .btn-main-search { padding: 14px 32px; width: 100%; }
  .filters-grid { grid-template-columns: 1fr 1fr; gap: 12px; }

  /* Details Page */
  .details-content { grid-template-columns: 1fr; padding: 40px 16px 30px; }
  .details-poster { max-width: 160px; margin: 0 auto; }
  .episode-item { grid-template-columns: 1fr; }
  
  /* Cast Row */
  .cast-grid { gap: 10px; }
  .cast-carousel { gap: 10px; }
  .cast-carousel > .cast-card { flex-basis: 110px !important; width: 110px !important; }
  .cast-name { font-size: 13px !important; }
  .cast-role { font-size: 11px !important; }
  
  /* Footer */
  .site-footer .container { grid-template-columns: 1fr; gap: 20px; }
}

/* ═══════════════════════════════════════════════
   MOBILE EPISODE LIST FIX (Force Side-by-Side)
   ═══════════════════════════════════════════════ */
@media screen and (max-width: 768px) {
  .episode-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important; /* ලිස්ට් එකේ එපිසෝඩ් අතර ඉඩ අඩු කළා */
  }

  .episode-item {
    display: grid !important;
    grid-template-columns: 110px 1fr !important; /* බලෙන්ම පින්තූරය 110px, අකුරු ඉතුරු ඉඩ */
    gap: 12px !important;
    padding: 10px !important;
    align-items: center !important; /* අකුරු සහ පින්තූරය මැදට ගන්න */
    border-radius: 8px !important;
  }

  .episode-item > div:first-child {
    width: 110px !important; /* පින්තූරය තියෙන කොටස */
  }

  .episode-thumb {
    width: 100% !important;
    height: 62px !important; /* 16:9 රේෂියෝ එකට හැදුවා */
    aspect-ratio: auto !important;
    object-fit: cover !important;
    border-radius: 6px !important;
  }

  /* Play අයිකන් එක පොඩි කළා */
  .episode-item svg {
    width: 24px !important;
    height: 24px !important;
  }

  .episode-body {
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
  }

  .episode-num {
    font-size: 12px !important;
    margin-bottom: 2px !important;
  }

  .episode-title {
    font-size: 14px !important;
    line-height: 1.3 !important;
    margin-bottom: 4px !important;
  }

  .episode-overview {
    font-size: 11px !important;
    -webkit-line-clamp: 2 !important; /* විස්තරය පේළි 2ක් විතරයි පෙන්වන්නේ */
    margin-bottom: 6px !important;
  }
  
  /* Watch Now / Coming soon අකුරු පොඩි කළා */
  .episode-body > div:last-child {
    font-size: 11px !important;
    margin-top: 0 !important;
  }
}

@media screen and (max-width: 360px) {
  .site-header .container {
    gap: 4px !important;
    padding-right: 14px !important;
    padding-left: 14px !important;
  }

  .site-logo { margin-right: 0 !important; }
  .site-nav { gap: 6px !important; }
  .site-nav a { font-size: 11px !important; }
  .nav-tools { gap: 4px !important; }
  .nav-search-toggle, .nav-filter-toggle { width: 28px !important; height: 28px !important; }
  .nav-search-toggle svg { width: 15px !important; height: 15px !important; }
  .nav-auth { gap: 4px !important; }
  .btn-nav, .btn-nav-outline { padding: 5px 7px !important; font-size: 10px !important; }
  .nav-user { font-size: 10px !important; padding: 3px 4px !important; }
}