/* ============================================================
   SmartOTT TV — Chromium 32 / LG webOS 1.x compatible
   No CSS custom properties, no CSS Grid, no flex-gap,
   no aspect-ratio, no inset, no backdrop-filter.
   ============================================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: #141414;
  color: #fff;
  font-family: "Netflix Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
  overflow-x: hidden;
}

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

/* ---------- Top Navigation ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; height: 68px;
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  -webkit-justify-content: space-between; justify-content: space-between;
  padding: 0 4%;
  z-index: 100;
  -webkit-transition: background 0.4s ease-out;
  transition: background 0.4s ease-out;
  background: -webkit-linear-gradient(top, rgba(0,0,0,0.9) 10%, rgba(0,0,0,0));
  background: linear-gradient(to bottom, rgba(0,0,0,0.9) 10%, rgba(0,0,0,0));
}
.nav.scrolled { background: #141414; }

.nav-left { display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center; }
.nav-left > * { margin-right: 40px; }
.nav-left > *:last-child { margin-right: 0; }
.nav-logo {
  font-family: "Bebas Neue", Impact, sans-serif;
  font-weight: 900;
  color: #e50914;
  font-size: 28px;
  letter-spacing: 1px;
  text-shadow: 0 2px 6px rgba(0,0,0,0.6);
}
.nav-logo span { color: #fff; }

.nav-menu { list-style: none; display: -webkit-flex; display: flex; }
.nav-menu li { margin-right: 22px; }
.nav-menu li:last-child { margin-right: 0; }
.nav-menu a {
  font-size: 14px; color: #fff; opacity: 0.85;
  -webkit-transition: opacity 0.2s, color 0.2s;
  transition: opacity 0.2s, color 0.2s;
}
.nav-menu a:hover, .nav-menu a.active { opacity: 1; color: #fff; }
.nav-menu a.active { font-weight: 600; }

.nav-right { display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center; }
.nav-right > * { margin-left: 18px; }
.nav-right > *:first-child { margin-left: 0; }
.nav-right .icon-btn {
  width: 34px; height: 34px;
  display: -webkit-inline-flex; display: inline-flex;
  -webkit-align-items: center; align-items: center;
  -webkit-justify-content: center; justify-content: center;
  border-radius: 50%;
  -webkit-transition: background 0.2s; transition: background 0.2s;
}
.nav-right .icon-btn:hover { background: rgba(255,255,255,0.1); }
.nav-search input {
  background: rgba(0,0,0,0.75);
  border: 1px solid rgba(255,255,255,0.08);
  color: #fff;
  padding: 7px 12px;
  border-radius: 2px;
  width: 230px;
  font-size: 14px;
  outline: none;
}
.nav-search input:focus { border-color: #fff; }

.avatar {
  width: 32px; height: 32px; border-radius: 4px;
  background: -webkit-linear-gradient(135deg, #e50914, #b20710);
  background: linear-gradient(135deg, #e50914, #b20710);
  display: -webkit-inline-flex; display: inline-flex;
  -webkit-align-items: center; align-items: center;
  -webkit-justify-content: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}

/* ---------- Login Page ---------- */
.login-page {
  min-height: 100vh;
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  -webkit-justify-content: center; justify-content: center;
  position: relative;
  background:
    -webkit-linear-gradient(top, rgba(0,0,0,0.55), rgba(0,0,0,0.75) 60%, #141414),
    url("https://images.unsplash.com/photo-1489599208107-8eedb3f71d7a?auto=format&fit=crop&w=1920&q=80") center top no-repeat;
  background:
    linear-gradient(to bottom, rgba(0,0,0,0.55), rgba(0,0,0,0.75) 60%, #141414),
    url("https://images.unsplash.com/photo-1489599208107-8eedb3f71d7a?auto=format&fit=crop&w=1920&q=80") center top no-repeat;
  background-size: cover, cover;
}
.login-brand {
  position: absolute; top: 20px; left: 40px;
  font-family: "Bebas Neue", Impact, sans-serif;
  font-weight: 900;
  color: #e50914;
  font-size: 36px;
}
.login-brand span { color: #fff; }
.login-card {
  background: rgba(0,0,0,0.78);
  border-radius: 6px;
  padding: 56px 60px;
  width: 100%; max-width: 430px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.7);
}
.login-card h1 { font-size: 32px; margin-bottom: 26px; }
.login-field { position: relative; margin-bottom: 16px; }
.login-field input {
  width: 100%;
  background: #333;
  border: none;
  border-radius: 4px;
  color: #fff;
  padding: 18px 16px 4px;
  font-size: 16px;
  outline: none;
  -webkit-transition: background 0.2s; transition: background 0.2s;
}
.login-field input:focus { background: #454545; }
.login-field label {
  position: absolute; left: 16px; top: 16px;
  color: #8c8c8c; font-size: 16px;
  pointer-events: none;
  -webkit-transition: all 0.2s; transition: all 0.2s;
}
.login-field input:focus + label,
.login-field input:not(:placeholder-shown) + label {
  top: 6px; font-size: 11px;
}
.login-btn {
  width: 100%;
  background: #e50914;
  color: #fff;
  padding: 14px;
  border-radius: 4px;
  font-size: 16px;
  font-weight: 700;
  margin-top: 18px;
  -webkit-transition: background 0.2s; transition: background 0.2s;
}
.login-btn:hover { background: #f40612; }
.login-btn:disabled { background: #5a0a10; cursor: not-allowed; }
.login-error {
  background: #e87c03;
  color: #000;
  padding: 10px 14px;
  border-radius: 4px;
  margin-bottom: 14px;
  font-size: 14px;
  display: none;
}
.login-error.visible { display: block; }
.login-hint {
  color: #b3b3b3;
  font-size: 13px;
  margin-top: 40px;
  line-height: 1.55;
}
.login-api-toggle { margin: -6px 0 16px; text-align: right; }
.login-api-toggle a {
  color: #999;
  font-size: 12px;
  text-decoration: none;
}
.login-api-toggle a:hover { color: #fff; text-decoration: underline; }
.login-api-field .login-hint { margin-top: 8px; font-size: 12px; }

/* ---------- Cache loader ---------- */
.cache-page {
  min-height: 100vh;
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  -webkit-justify-content: center; justify-content: center;
  background: -webkit-radial-gradient(ellipse at center, #1e1e1e 0%, #0a0a0a 80%);
  background: radial-gradient(ellipse at center, #1e1e1e 0%, #0a0a0a 80%);
}
.cache-box {
  text-align: center;
  max-width: 520px;
  padding: 0 20px;
}
.cache-box h1 {
  font-family: "Bebas Neue", Impact, sans-serif;
  color: #e50914;
  font-size: 56px;
  letter-spacing: 2px;
  margin-bottom: 8px;
}
.cache-box h1 span { color: #fff; }
.cache-box h2 { font-size: 20px; font-weight: 400; color: #b3b3b3; margin-bottom: 34px; }
.progress-bar {
  height: 6px; width: 100%; border-radius: 3px; overflow: hidden;
  background: rgba(255,255,255,0.1);
}
.progress-bar-fill {
  height: 100%; width: 0%;
  background: -webkit-linear-gradient(left, #e50914, #ff5b66);
  background: linear-gradient(to right, #e50914, #ff5b66);
  border-radius: 3px;
  -webkit-transition: width 0.35s; transition: width 0.35s;
  box-shadow: 0 0 10px rgba(229,9,20,0.6);
}
.cache-status {
  margin-top: 18px; font-size: 14px; color: #b3b3b3;
  min-height: 22px;
}
.cache-stats {
  display: -webkit-flex; display: flex;
  -webkit-justify-content: center; justify-content: center;
  margin-top: 32px;
}
.cache-stats .stat {
  text-align: center;
  margin-right: 30px;
}
.cache-stats .stat:last-child { margin-right: 0; }
.cache-stats .stat strong {
  display: block; color: #fff; font-size: 22px;
}
.cache-stats .stat span { color: #b3b3b3; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }

/* ---------- Hero / Billboard ---------- */
.hero {
  position: relative;
  min-height: 80vh;
  padding: 0 4%;
  display: -webkit-flex; display: flex;
  -webkit-align-items: flex-end; align-items: flex-end;
  padding-bottom: 160px;
  background-size: cover; background-position: center top;
  margin-top: -68px;
}
.hero:after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0; height: 40%;
  background: -webkit-linear-gradient(bottom, #141414 0%, rgba(20,20,20,0.6) 50%, rgba(20,20,20,0));
  background: linear-gradient(to top, #141414 0%, rgba(20,20,20,0.6) 50%, rgba(20,20,20,0));
  pointer-events: none;
}
.hero:before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 40%;
  background: -webkit-linear-gradient(top, rgba(0,0,0,0.65), rgba(0,0,0,0));
  background: linear-gradient(to bottom, rgba(0,0,0,0.65), rgba(0,0,0,0));
  pointer-events: none;
}
.hero-inner { position: relative; z-index: 2; max-width: 640px; }
.hero-title {
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: 5rem;
  line-height: 1;
  margin-bottom: 18px;
  text-shadow: 0 3px 12px rgba(0,0,0,0.8);
  letter-spacing: 1px;
}
.hero-meta {
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  margin-bottom: 14px;
  color: #b3b3b3;
  font-size: 14px;
}
.hero-meta > * { margin-right: 14px; }
.hero-meta > *:last-child { margin-right: 0; }
.hero-meta .score { color: #46d369; font-weight: 700; }
.hero-meta .pill {
  padding: 2px 8px; border: 1px solid rgba(255,255,255,0.08); border-radius: 2px; font-size: 12px;
}
.hero-desc {
  font-size: 17px;
  line-height: 1.45;
  color: #e5e5e5;
  margin-bottom: 22px;
  max-width: 560px;
  text-shadow: 0 2px 6px rgba(0,0,0,0.6);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hero-actions { display: -webkit-flex; display: flex; }
.hero-actions > * { margin-right: 12px; }
.hero-actions > *:last-child { margin-right: 0; }

.btn {
  display: -webkit-inline-flex; display: inline-flex;
  -webkit-align-items: center; align-items: center;
  padding: 11px 26px;
  font-size: 15px; font-weight: 700;
  border-radius: 4px;
  -webkit-transition: -webkit-transform 0.15s, background 0.2s, color 0.2s;
  transition: transform 0.15s, background 0.2s, color 0.2s;
}
.btn svg, .btn img { margin-right: 8px; }
.btn:hover { -webkit-transform: translateY(-1px); transform: translateY(-1px); }
.btn-primary { background: #fff; color: #000; }
.btn-primary:hover { background: rgba(255,255,255,0.85); }
.btn-secondary { background: rgba(109,109,110,0.7); color: #fff; }
.btn-secondary:hover { background: rgba(109,109,110,0.5); }
.btn-accent { background: #e50914; color: #fff; }
.btn-accent:hover { background: #f40612; }

/* ---------- Rows / Carousels ---------- */
.rows { padding: 0 4%; position: relative; z-index: 3; margin-top: -40px; }
.row { margin-bottom: 42px; }
.row-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 14px;
  padding-top: 10px;
}
.row-viewport {
  position: relative;
}
.row-track {
  display: -webkit-flex; display: flex;
  -webkit-flex-direction: row; flex-direction: row;
  -webkit-flex-wrap: nowrap; flex-wrap: nowrap;
  -webkit-align-items: stretch; align-items: stretch;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 20px;
  width: 100%;
}
.row-track > .card { margin-right: 8px; }
.row-track > .card:last-child { margin-right: 0; }
.row-track::-webkit-scrollbar { display: none; }

.row-arrow {
  position: absolute; top: 0; bottom: 20px;
  width: 50px;
  background: rgba(20,20,20,0.6);
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  -webkit-justify-content: center; justify-content: center;
  font-size: 30px; color: #fff;
  opacity: 0;
  -webkit-transition: opacity 0.2s, background 0.2s;
  transition: opacity 0.2s, background 0.2s;
  z-index: 4;
}
.row-viewport:hover .row-arrow { opacity: 1; }
.row-arrow.left { left: 0; border-radius: 0 4px 4px 0; }
.row-arrow.right { right: 0; border-radius: 4px 0 0 4px; }
.row-arrow:hover { background: rgba(20,20,20,0.85); }

/* ---------- Card ---------- */
.card {
  -webkit-flex: 0 0 240px; flex: 0 0 240px;
  display: block;
  box-sizing: border-box;
  width: 240px;
  min-width: 240px;
  max-width: 240px;
  height: 135px;
  background: #222;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  -webkit-transition: -webkit-transform 0.3s, box-shadow 0.3s;
  transition: transform 0.3s, box-shadow 0.3s;
}
.card:hover {
  -webkit-transform: scale(1.12); transform: scale(1.12);
  z-index: 5;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
}
.card img {
  display: block;
  width: 100%; height: 100%;
  -o-object-fit: cover; object-fit: cover;
  background: #000;
}
.card-fallback {
  width: 100%; height: 100%;
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  -webkit-justify-content: center; justify-content: center;
  padding: 10px;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  background: -webkit-linear-gradient(135deg, #222, #000);
  background: linear-gradient(135deg, #222, #000);
  color: #b3b3b3;
}
.card-badge {
  position: absolute; top: 8px; left: 8px;
  background: #e50914; color: #fff;
  padding: 2px 7px; font-size: 11px; font-weight: 700;
  border-radius: 2px; text-transform: uppercase; letter-spacing: 0.5px;
}
.card-overlay {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 10px;
  background: -webkit-linear-gradient(bottom, rgba(0,0,0,0.9), rgba(0,0,0,0));
  background: linear-gradient(to top, rgba(0,0,0,0.9), rgba(0,0,0,0));
  font-size: 13px;
  opacity: 0;
  -webkit-transition: opacity 0.3s; transition: opacity 0.3s;
}
.card:hover .card-overlay { opacity: 1; }
.card-title { font-weight: 700; }
.card-meta { color: #b3b3b3; font-size: 11px; margin-top: 3px; }

/* Poster card variation */
.card.poster {
  -webkit-flex-basis: 180px; flex-basis: 180px;
  width: 180px;
  min-width: 180px;
  max-width: 180px;
  height: 270px;
}
.card.poster .card-fallback { font-size: 16px; }

/* ---------- Grid pages (flex fallback for no-CSS-Grid) ---------- */
.page-title {
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: 40px;
  letter-spacing: 1px;
  padding: 98px 4% 20px;
}
.filter-bar {
  display: -webkit-flex; display: flex;
  -webkit-flex-wrap: wrap; flex-wrap: wrap;
  padding: 0 4% 20px;
}
.filter-bar > * { margin-right: 12px; margin-bottom: 8px; }
.filter-chip {
  background: #222;
  color: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  border: 1px solid rgba(255,255,255,0.08);
  -webkit-transition: all 0.2s; transition: all 0.2s;
}
.filter-chip:hover { background: #333; }
.filter-chip.active { background: #fff; color: #000; border-color: #fff; }

.grid {
  display: -webkit-flex; display: flex;
  -webkit-flex-wrap: wrap; flex-wrap: wrap;
  padding: 0 4% 60px;
  margin-left: -7px; margin-right: -7px;
}
.grid > .card,
.grid > .card.poster {
  width: 180px;
  min-width: 180px;
  max-width: 180px;
  height: 270px;
  margin: 7px;
  -webkit-flex: 0 0 180px; flex: 0 0 180px;
}
.grid > .card.landscape {
  width: 240px;
  min-width: 240px;
  max-width: 240px;
  height: 135px;
  -webkit-flex: 0 0 240px; flex: 0 0 240px;
}

/* ---------- Detail page ---------- */
.detail {
  position: relative;
  min-height: 100vh;
}
.detail-backdrop {
  position: absolute;
  top: 0; left: 0; right: 0; height: 80vh;
  background-size: cover; background-position: center top;
  z-index: 0;
}
.detail-backdrop:after {
  content: "";
  position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  background: -webkit-linear-gradient(top, rgba(20,20,20,0.3) 0%, rgba(20,20,20,0.7) 60%, #141414 100%);
  background: linear-gradient(to bottom, rgba(20,20,20,0.3) 0%, rgba(20,20,20,0.7) 60%, #141414 100%);
}
.detail-inner {
  position: relative;
  z-index: 2;
  padding: 128px 4% 60px;
  max-width: 1400px;
  margin: 0 auto;
}
.detail-header {
  display: -webkit-flex; display: flex;
  -webkit-flex-wrap: wrap; flex-wrap: wrap;
}
.detail-header > *:first-child {
  width: 300px;
  margin-right: 40px;
  -webkit-flex: 0 0 300px; flex: 0 0 300px;
}
.detail-header > *:last-child {
  -webkit-flex: 1 1 auto; flex: 1 1 auto;
  min-width: 0;
}
.detail-poster {
  width: 100%;
  height: 450px;
  border-radius: 4px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
  background: #000;
  -o-object-fit: cover; object-fit: cover;
}
.detail-title {
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: 3.5rem;
  margin-bottom: 14px; line-height: 1;
}
.detail-meta {
  display: -webkit-flex; display: flex;
  color: #b3b3b3; margin-bottom: 18px; font-size: 14px;
  -webkit-align-items: center; align-items: center;
  -webkit-flex-wrap: wrap; flex-wrap: wrap;
}
.detail-meta > * { margin-right: 14px; }
.detail-meta > *:last-child { margin-right: 0; }
.detail-desc { font-size: 16px; max-width: 760px; color: #e5e5e5; margin-bottom: 22px; }
.detail-actions {
  display: -webkit-flex; display: flex;
  -webkit-flex-wrap: wrap; flex-wrap: wrap;
}
.detail-actions > * { margin-right: 10px; margin-bottom: 8px; }

.season-tabs {
  display: -webkit-flex; display: flex;
  -webkit-flex-wrap: wrap; flex-wrap: wrap;
  margin: 40px 0 16px;
}
.season-tabs > * { margin-right: 8px; margin-bottom: 8px; }
.season-tab {
  padding: 8px 16px; border-radius: 2px;
  background: #222; color: #fff;
  font-size: 14px;
}
.season-tab.active { background: #e50914; }

.episodes {
  display: -webkit-flex; display: flex;
  -webkit-flex-direction: column; flex-direction: column;
}
.episodes > * { margin-bottom: 8px; }
.episode-layout {
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  padding: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  cursor: pointer;
  -webkit-transition: background 0.2s; transition: background 0.2s;
}
.episode-layout:hover { background: #1f1f1f; }
.episode-num {
  width: 60px;
  -webkit-flex: 0 0 60px; flex: 0 0 60px;
  font-size: 22px; color: #b3b3b3; font-weight: 700; text-align: center;
  margin-right: 16px;
}
.episode-thumb {
  width: 170px;
  height: 96px;
  -webkit-flex: 0 0 170px; flex: 0 0 170px;
  -o-object-fit: cover; object-fit: cover;
  background: #000; border-radius: 3px;
  margin-right: 16px;
}
.episode-body {
  -webkit-flex: 1 1 auto; flex: 1 1 auto;
  min-width: 0;
}
.episode-body h4 { font-size: 16px; margin-bottom: 4px; }
.episode-body p {
  color: #b3b3b3; font-size: 13px; line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Player page ---------- */
.player-page {
  width: 100vw; height: 100vh;
  background: #000;
  display: -webkit-flex; display: flex;
  -webkit-flex-direction: column; flex-direction: column;
}
.player-top {
  padding: 16px 30px;
  background: -webkit-linear-gradient(top, rgba(0,0,0,0.95), rgba(0,0,0,0));
  background: linear-gradient(to bottom, rgba(0,0,0,0.95), rgba(0,0,0,0));
  color: #fff;
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 10;
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  -webkit-justify-content: space-between; justify-content: space-between;
  opacity: 0;
  -webkit-transition: opacity 0.3s; transition: opacity 0.3s;
}
.player-page:hover .player-top { opacity: 1; }
.player-title { font-size: 20px; font-weight: 700; }
.player-back {
  background: rgba(0,0,0,0.6);
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 14px;
}
video.player {
  width: 100%; height: 100%;
  -o-object-fit: contain; object-fit: contain;
  background: #000;
}

/* ---------- Live TV ---------- */
.livetv-layout {
  display: -webkit-flex; display: flex;
  min-height: calc(100vh - 68px);
  margin-top: 68px;
}
.livetv-sidebar {
  width: 320px;
  -webkit-flex: 0 0 320px; flex: 0 0 320px;
  background: #0a0a0a;
  border-right: 1px solid rgba(255,255,255,0.08);
  overflow-y: auto;
  max-height: calc(100vh - 68px);
}
.livetv-main {
  -webkit-flex: 1 1 auto; flex: 1 1 auto;
  padding: 20px;
  min-width: 0;
}
.livetv-category {
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  cursor: pointer;
  font-size: 14px;
  -webkit-transition: background 0.2s; transition: background 0.2s;
}
.livetv-category:hover { background: #1f1f1f; }
.livetv-category.active { background: #e50914; color: #fff; }

.channel-list {
  display: -webkit-flex; display: flex;
  -webkit-flex-wrap: wrap; flex-wrap: wrap;
  margin-left: -6px; margin-right: -6px;
}
.channel {
  width: 180px;
  -webkit-flex: 0 0 180px; flex: 0 0 180px;
  margin: 6px;
  background: #222;
  border-radius: 4px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  -webkit-transition: -webkit-transform 0.2s, background 0.2s;
  transition: transform 0.2s, background 0.2s;
  display: -webkit-flex; display: flex;
  -webkit-flex-direction: column; flex-direction: column;
  -webkit-align-items: center; align-items: center;
}
.channel > * { margin-bottom: 10px; }
.channel > *:last-child { margin-bottom: 0; }
.channel:hover { -webkit-transform: translateY(-3px); transform: translateY(-3px); background: #2a2a2a; }
.channel img { width: 60px; height: 60px; -o-object-fit: contain; object-fit: contain; background: #000; border-radius: 4px; }
.channel-name { font-size: 13px; font-weight: 600; word-break: break-word; }

/* ---------- Search ---------- */
.search-input-wrap {
  max-width: 720px;
  margin: 108px auto 30px;
  padding: 0 4%;
}
.search-big {
  width: 100%;
  background: rgba(0,0,0,0.6);
  border: 2px solid rgba(255,255,255,0.08);
  color: #fff;
  padding: 18px 22px;
  font-size: 20px;
  border-radius: 6px;
  outline: none;
  -webkit-transition: border-color 0.2s; transition: border-color 0.2s;
}
.search-big:focus { border-color: #e50914; }

/* ---------- Helpers ---------- */
.loading {
  display: -webkit-flex; display: flex;
  -webkit-justify-content: center; justify-content: center;
  -webkit-align-items: center; align-items: center;
  padding: 60px 0; color: #b3b3b3;
}
.spinner {
  width: 40px; height: 40px;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: #e50914;
  border-radius: 50%;
  -webkit-animation: spin 0.9s linear infinite;
  animation: spin 0.9s linear infinite;
}
@-webkit-keyframes spin { to { -webkit-transform: rotate(360deg); } }
@keyframes spin { to { -webkit-transform: rotate(360deg); transform: rotate(360deg); } }

.empty-state {
  text-align: center; padding: 80px 20px; color: #b3b3b3;
}
.empty-state h3 { color: #fff; margin-bottom: 10px; }

.hidden { display: none !important; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .nav { padding: 0 16px; }
  .nav-menu { display: none; }
  .nav-search input { width: 150px; }
  .hero { padding-bottom: 80px; min-height: 70vh; }
  .hero-title { font-size: 3rem; }
  .hero-desc { font-size: 14px; }
  .card {
    -webkit-flex-basis: 180px; flex-basis: 180px;
    width: 180px; min-width: 180px; max-width: 180px;
    height: 100px;
  }
  .card.poster {
    -webkit-flex-basis: 130px; flex-basis: 130px;
    width: 130px; min-width: 130px; max-width: 130px;
    height: 200px;
  }
  .detail-header > *:first-child { width: 100%; -webkit-flex: 1 1 100%; flex: 1 1 100%; margin-right: 0; margin-bottom: 24px; }
  .detail-poster { max-width: 240px; height: auto; }
  .detail-title { font-size: 2.2rem; }
  .livetv-layout { -webkit-flex-direction: column; flex-direction: column; }
  .livetv-sidebar { width: 100%; -webkit-flex: 0 0 auto; flex: 0 0 auto; max-height: 180px; display: -webkit-flex; display: flex; overflow-x: auto; }
  .livetv-category { min-width: 140px; border-bottom: none; border-right: 1px solid rgba(255,255,255,0.08); }
  .episode-num { width: 40px; -webkit-flex: 0 0 40px; flex: 0 0 40px; }
  .episode-thumb { width: 120px; -webkit-flex: 0 0 120px; flex: 0 0 120px; height: 68px; }
  .grid > .card, .grid > .card.poster { width: 130px; min-width: 130px; max-width: 130px; height: 200px; -webkit-flex: 0 0 130px; flex: 0 0 130px; }
  .page-title { font-size: 28px; }
}

@media (max-width: 500px) {
  .login-card { padding: 40px 28px; }
  .hero-title { font-size: 2.2rem; }
}

/* ================================================================
   D-pad focus ring
   ================================================================ */
:focus { outline: none; }

a:focus, button:focus, input:focus, textarea:focus, select:focus,
[tabindex]:focus, .livetv-category:focus, .season-tab:focus,
.filter-chip:focus {
  outline: none;
}

.card:focus,
.channel:focus {
  outline: 3px solid #fff;
  outline-offset: 3px;
  -webkit-transform: scale(1.12); transform: scale(1.12);
  z-index: 5;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
}
.grid .card:focus { -webkit-transform: scale(1.04); transform: scale(1.04); }

.filter-chip:focus {
  outline: 2px solid #fff;
  outline-offset: 2px;
  background: #333;
}
.filter-chip.active:focus { background: #fff; color: #000; }

.livetv-category:focus {
  outline: 2px solid #fff;
  outline-offset: -2px;
  background: #2a2a2a;
}
.livetv-category.active:focus { background: #e50914; }

.season-tab:focus {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.btn:focus, .login-btn:focus {
  outline: 2px solid #fff;
  outline-offset: 3px;
}
.nav-menu a:focus {
  outline: 2px solid #fff;
  outline-offset: 4px;
  opacity: 1;
}
.icon-btn:focus { outline: 2px solid #fff; outline-offset: 2px; background: rgba(255,255,255,0.12); }

.login-field input:focus { box-shadow: 0 0 0 2px #fff; }
.search-big:focus { border-color: #e50914; box-shadow: 0 0 0 3px rgba(229,9,20,0.35); }

/* ================================================================
   On-screen virtual keyboard
   ================================================================ */
.vkb {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.94);
  border-top: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 -20px 60px rgba(0,0,0,0.6);
  -webkit-transform: translateY(110%); transform: translateY(110%);
  -webkit-transition: -webkit-transform 0.35s; transition: transform 0.35s;
  padding: 18px 20px 22px;
}
.vkb.vkb-open { -webkit-transform: translateY(0); transform: translateY(0); }

.vkb-inner {
  max-width: 1080px;
  margin: 0 auto;
}

.vkb-preview {
  background: #111;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 18px;
  color: #fff;
  min-height: 40px;
  letter-spacing: 0.5px;
  word-break: break-all;
  font-family: "Menlo", "Consolas", monospace;
}

.vkb-keys {
  display: -webkit-flex; display: flex;
  -webkit-flex-direction: column; flex-direction: column;
}
.vkb-keys > * { margin-bottom: 8px; }
.vkb-keys > *:last-child { margin-bottom: 0; }
.vkb-row {
  display: -webkit-flex; display: flex;
  -webkit-justify-content: center; justify-content: center;
}
.vkb-row > * { margin-right: 8px; }
.vkb-row > *:last-child { margin-right: 0; }

.vkb-key {
  -webkit-flex: 1 1 0; flex: 1 1 0;
  min-width: 46px;
  height: 54px;
  background: #2a2a2a;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 6px;
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  -webkit-transition: -webkit-transform 0.12s, background 0.18s, border-color 0.18s;
  transition: transform 0.12s, background 0.18s, border-color 0.18s;
  -webkit-user-select: none; user-select: none;
}
.vkb-key:hover { background: #3a3a3a; }
.vkb-key:active { -webkit-transform: translateY(1px); transform: translateY(1px); background: #4a4a4a; }
.vkb-key:focus {
  outline: none;
  border-color: #fff;
  background: #e50914;
  color: #fff;
  -webkit-transform: scale(1.08); transform: scale(1.08);
  box-shadow: 0 6px 18px rgba(229,9,20,0.4);
}
.vkb-key-wide { -webkit-flex: 2 1 0; flex: 2 1 0; font-size: 14px; letter-spacing: 0.5px; }
.vkb-key-space { -webkit-flex: 6 1 0; flex: 6 1 0; }
.vkb-key-active { background: #fff; color: #000; border-color: #fff; }

/* Push page content up just enough when the keyboard is open */
body.vkb-active { padding-bottom: 360px; }

@media (max-width: 700px) {
  .vkb { padding: 12px 10px 16px; }
  .vkb-key { height: 46px; min-width: 30px; font-size: 15px; }
  .vkb-key-wide { font-size: 12px; }
  body.vkb-active { padding-bottom: 300px; }
}
