/* ============================================================
   BASE
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box; margin: 0; padding: 0;
  -webkit-tap-highlight-color: transparent; /* remove tap flash on mobile/TV */
}

/* ── Smooth font rendering ── */
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ── iOS/Android momentum scrolling ── */
.panel-scroll,
.grid-container,
.detail-info-col,
.lives-categories,
.lives-channels,
.browse-sidebar,
.ep-list-container {
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

/* ── Hardware acceleration for animated elements ── */
.grid-item, .home-card, .stg-tile, .cat-item, .sidebar-item, .d-btn {
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  will-change: transform;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

/* ── TV / Keyboard focus ring ── */
:focus-visible {
  outline: 3px solid #e040fb;
  outline-offset: 3px;
  border-radius: 4px;
}
:focus:not(:focus-visible) { outline: none; }

/* ── TV cursor auto-hide ── */
body.tv-cursor-hidden,
body.tv-cursor-hidden * { cursor: none !important; }

/* ── Safe area insets (notch phones/TVs) ── */
body {
  padding-left:   env(safe-area-inset-left, 0);
  padding-right:  env(safe-area-inset-right, 0);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

:root {
  --bg:        #0d0d14;
  --bg2:       #13131e;
  --bg3:       #1a1a28;
  --bg4:       #212133;
  --accent:    #6c63ff;
  --accent2:   #4a43c8;
  --accent-dim:#2a2460;
  --text:      #ffffff;
  --muted:     rgba(255,255,255,.55);
  --muted2:    rgba(255,255,255,.3);
  --radius:    8px;
  --bar-h:     48px;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  font-family: 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   VIEWS
   ============================================================ */
.view {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.hidden { display: none !important; }

/* ============================================================
   SCROLLBAR
   ============================================================ */
.panel-scroll { overflow-y: auto; overflow-x: hidden; }
.panel-scroll::-webkit-scrollbar { width: 4px; }
.panel-scroll::-webkit-scrollbar-track { background: transparent; }
.panel-scroll::-webkit-scrollbar-thumb { background: var(--accent-dim); border-radius: 2px; }

/* ============================================================
   SPINNER
   ============================================================ */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(255,255,255,.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   BUTTONS / SHARED
   ============================================================ */
.btn-primary {
  width: 100%; height: 52px;
  background: linear-gradient(90deg, #1e1b6e, #2d2a8a, #3a37a0);
  border: none; border-radius: 4px;
  color: #fff; font-size: 13px; font-weight: 700; letter-spacing: 2px;
  cursor: pointer; transition: opacity .15s;
}
.btn-primary:hover { opacity: .88; }
.btn-secondary {
  width: 100%; height: 52px;
  background: #4a4690;
  border: none; border-radius: 4px;
  color: #fff; font-size: 13px; font-weight: 700; letter-spacing: 2px;
  cursor: pointer; transition: opacity .15s;
}
.btn-secondary:hover { opacity: .88; }

.icon-btn {
  background: none; border: none; color: rgba(255,255,255,.8);
  font-size: 18px; cursor: pointer; padding: 6px 10px;
  transition: color .15s;
}
.icon-btn:hover { color: #fff; }

.back-btn {
  background: none; border: none; color: rgba(255,255,255,.8);
  font-size: 17px; cursor: pointer; padding: 6px 12px;
  transition: color .15s;
}
.back-btn:hover { color: #fff; }

/* ============================================================
   TOP BARS
   ============================================================ */
.top-bar {
  height: var(--bar-h); background: var(--bg2);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.top-bar-left { display: flex; align-items: center; gap: 10px; }
.top-title { font-size: 16px; font-weight: 600; }
.top-icon { color: var(--muted); font-size: 18px; cursor: pointer; padding: 4px 8px; }
.logo-small { width: 26px; height: 26px; }
.logo-small-img { width: 32px; height: 32px; object-fit: contain; }

.content-top-bar {
  height: var(--bar-h); background: var(--bg2);
  display: flex; align-items: center; gap: 0;
  padding: 0 8px; flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,.07);
  z-index: 10;
}
.transparent-bar { background: rgba(13,13,20,.75) !important; }
.content-tabs {
  display: flex; gap: 4px; flex: 1; justify-content: center;
}
.tab {
  background: none; border: none; color: var(--muted);
  font-size: 13px; font-weight: 600; letter-spacing: .8px;
  padding: 8px 18px; cursor: pointer; border-radius: 4px;
  transition: color .15s, background .15s;
  display: flex; align-items: center; gap: 6px;
}
.tab:hover { color: #fff; background: rgba(255,255,255,.06); }
.tab.active { color: var(--accent); }
.tab.active i { color: var(--accent); }
.search-top-btn { font-size: 17px; }

/* ============================================================
   LOGIN VIEW
   ============================================================ */
#view-login {
  justify-content: center; align-items: center;
  background: #0a0a0f;
}

/* Poster grid background */
.login-bg-grid {
  position: fixed; inset: -60%;
  display: flex; flex-direction: column; gap: 5px;
  transform: rotate(-14deg);
  z-index: 0;
  pointer-events: none;
}
.poster-row {
  flex-shrink: 0; display: flex;
}
.poster-row-inner {
  display: flex; gap: 5px; flex-shrink: 0;
  animation: poster-scroll 32s linear infinite;
}
.poster-row:nth-child(even) .poster-row-inner {
  animation-direction: reverse;
}
.poster-cell {
  width: 186px; height: 278px; flex-shrink: 0;
  background-size: cover; background-position: center;
  background-color: #111;
  border-radius: 6px;
}
@keyframes poster-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.login-overlay {
  position: absolute; inset: 0;
  background: rgba(5,5,10,.70);
  z-index: 1;
}
.login-content {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: center; gap: 60px;
  width: 100%; max-width: 900px; padding: 40px;
}
.login-logo {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  filter: drop-shadow(0 8px 50px rgba(0,0,0,.8));
}
.login-logo-img {
  width: 280px; height: 280px;
  display: block; object-fit: contain;
  border-radius: 28px;
}
.login-form-card { flex: 1; display: flex; flex-direction: column; gap: 14px; max-width: 480px; min-width: 320px; }

/* Login type tabs */
.login-tabs {
  display: flex; gap: 4px; margin-bottom: 16px;
}
.login-tab {
  flex: 1; padding: 10px 8px;
  background: rgba(255,255,255,.08); border: none; border-radius: 6px;
  color: rgba(255,255,255,.6); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .15s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.login-tab:hover { background: rgba(255,255,255,.14); color: #fff; }
.login-tab.active { background: var(--accent); color: #fff; }

/* Each login panel */
.login-panel { display: flex; flex-direction: column; gap: 13px; }

/* Login divider */
.login-divider {
  display: flex; align-items: center; gap: 12px;
  color: rgba(255,255,255,.35); font-size: 12px; letter-spacing: 2px;
}
.login-divider::before,
.login-divider::after {
  content: ''; flex: 1; height: 1px; background: rgba(255,255,255,.15);
}

/* Activation code button */
.btn-activate {
  width: 100%; height: 52px;
  background: linear-gradient(90deg, #b8860b, #ffd700, #b8860b);
  border: none; border-radius: 4px;
  color: #000; font-size: 14px; font-weight: 800; letter-spacing: 2px;
  cursor: pointer; transition: opacity .15s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-activate:hover { opacity: .88; }
.btn-activate:disabled { opacity: .5; cursor: not-allowed; }

/* Activation status message */
.act-status {
  padding: 10px 14px; border-radius: 6px; font-size: 13px;
  background: rgba(255,215,0,.15); color: #ffd700;
  border: 1px solid rgba(255,215,0,.3); text-align: center;
}
.act-status.error   { background: rgba(220,50,50,.2); color: #ff9090; border-color: rgba(220,50,50,.3); }
.act-status.success { background: rgba(40,200,80,.2); color: #90ff90; border-color: rgba(40,200,80,.3); }

/* MAC status message */
.mac-status {
  padding: 10px 14px; border-radius: 6px; font-size: 13px;
  background: rgba(108,99,255,.2); color: #c8b0ff;
  border: 1px solid rgba(108,99,255,.3);
}
.mac-status.error { background: rgba(220,50,50,.2); color: #ff9090; border-color: rgba(220,50,50,.3); }
.mac-status.success { background: rgba(40,180,80,.2); color: #90ffb0; border-color: rgba(40,180,80,.3); }
.form-field { position: relative; }
.form-field input {
  width: 100%; height: 52px;
  background: #fff;
  border: 1.5px solid #ccc;
  border-radius: 4px;
  padding: 0 48px 0 16px; font-size: 15px; color: #333; outline: none;
  transition: border-color .15s;
}
.form-field input:focus { border-color: var(--accent); }
.form-field input::placeholder { color: #aaa; }
.field-icon {
  position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  color: var(--accent); font-size: 15px; pointer-events: none;
}

/* ============================================================
   USERS VIEW
   ============================================================ */
#view-users { background: var(--bg); }

/* Compact user cards — scrollable row */
.users-container {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 16px;
  padding: 24px;
  overflow-y: auto;
}
.users-container::-webkit-scrollbar { width: 4px; }
.users-container::-webkit-scrollbar-thumb { background: var(--accent-dim); }

.user-cell {
  width: 240px;
  background: var(--bg3);
  border-radius: 10px;
  border: 2px solid rgba(255,255,255,.07);
  cursor: pointer;
  position: relative;
  transition: border-color .15s, background .15s;
  overflow: hidden;
  flex-shrink: 0;
}
.user-cell:hover { background: var(--bg4); border-color: rgba(255,255,255,.18); }
.user-cell.active { border-color: var(--accent); background: rgba(108,99,255,.1); }

.uc-spacer { display: none; }
.uc-info {
  padding: 16px 18px 18px;
  font-size: 13px;
  color: rgba(255,255,255,.82);
  line-height: 1.7;
}
.uc-info .uc-row { display: block; }

.uc-del-btn {
  position: absolute; top: 10px; right: 10px;
  background: none; border: none;
  color: rgba(255,80,80,.5); font-size: 13px; cursor: pointer;
  opacity: 0; transition: opacity .15s;
}
.user-cell:hover .uc-del-btn { opacity: 1; }
.uc-del-btn:hover { color: #ff6060; }

/* Add new user card */
.user-cell-add {
  width: 240px; height: 148px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  border: 2px dashed rgba(255,255,255,.15);
  cursor: pointer; background: var(--bg2);
  color: rgba(255,255,255,.3); font-size: 28px;
  transition: border-color .15s, color .15s;
  flex-shrink: 0;
}
.user-cell-add:hover { border-color: var(--accent); color: var(--accent); }

/* ============================================================
   HOME VIEW
   ============================================================ */
#view-home { background: var(--bg); }
.home-top-bar {
  height: var(--bar-h); display: flex; align-items: center;
  justify-content: space-between; padding: 0 20px; flex-shrink: 0;
}
.logo-home { width: 28px; height: 28px; cursor: pointer; }
.logo-home-img { width: 38px; height: 38px; object-fit: contain; cursor: pointer; }
.home-top-actions { display: flex; gap: 4px; }
.home-cards {
  flex: 1; display: flex; align-items: stretch; padding: 32px 32px 32px;
  gap: 12px; overflow: hidden;
}
.home-card {
  flex: 1; background: var(--bg2); border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding: 28px 20px 32px; cursor: pointer;
  transition: background .2s, transform .15s, box-shadow .2s;
  position: relative; overflow: hidden;
  border: 2px solid #b8860b;
  box-shadow: 0 0 12px rgba(184,134,11,.3), inset 0 0 30px rgba(184,134,11,.05);
}
.home-card:hover {
  border-color: #ffd700;
  box-shadow: 0 0 28px rgba(255,215,0,.5), inset 0 0 40px rgba(255,215,0,.08);
}
.home-card::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(108,99,255,.08) 100%);
}
.home-card:hover { background: var(--bg3); transform: translateY(-2px); }
.card-icon-wrap {
  flex: 1; display: flex; align-items: center; justify-content: center;
}
.card-icon-wrap svg {
  width: min(340px, 55vh);
  height: min(340px, 55vh);
  filter: drop-shadow(0 0 18px rgba(255,255,255,.15));
}
/* Thicker strokes for large icons */
.card-icon-wrap svg path,
.card-icon-wrap svg line,
.card-icon-wrap svg rect,
.card-icon-wrap svg circle,
.card-icon-wrap svg polygon {
  stroke-width: 3;
}
.card-title {
  font-size: 42px; font-weight: 800; letter-spacing: 5px;
  margin-bottom: 20px; color: #fff;
}
.card-meta {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  font-size: 22px; color: var(--muted);
}
.card-meta span { display: flex; align-items: center; gap: 10px; }
.card-meta i { font-size: 18px; }

/* ============================================================
   LIVES VIEW
   ============================================================ */
#view-lives { background: var(--bg); }
.lives-layout { flex: 1; display: flex; overflow: hidden; min-height: 0; }

/* ── Category column ── */
.lives-cat-col {
  width: 280px; flex-shrink: 0;
  display: flex; flex-direction: column;
  background: var(--bg2); border-right: 1px solid rgba(255,255,255,.06);
}
.lives-cat-title {
  color: #f5c518; font-size: 19px; font-weight: 700;
  padding: 14px 18px 12px; flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,.07);
  letter-spacing: .3px;
}
.lives-categories { flex: 1; }

/* Cat items */
.cat-item {
  padding: 12px 18px; font-size: 15px; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  transition: background .12s; line-height: 1.3;
  border-left: 3px solid transparent;
  color: rgba(255,255,255,.82);
}
.cat-item:hover { background: rgba(255,255,255,.06); }
.cat-item.active {
  background: linear-gradient(90deg, rgba(120,50,230,.55) 0%, rgba(90,30,180,.18) 100%);
  border-left-color: #9040ee;
  color: #fff; font-weight: 600;
}
.cat-num  { display: none; }  /* hide numbers in live categories */
.cat-dot  { display: none; }
.cat-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Channel column ── */
.lives-channels {
  width: 270px; flex-shrink: 0;
  background: #0e0e18; border-right: 1px solid rgba(255,255,255,.06);
}
.ch-item {
  padding: 9px 12px; font-size: 13px; cursor: pointer;
  display: flex; align-items: center; gap: 9px;
  border-bottom: 1px solid rgba(255,255,255,.04);
  transition: background .1s; color: rgba(255,255,255,.85);
}
.ch-item:hover { background: rgba(255,255,255,.07); }
.ch-item.active { background: #1565c0; color: #fff; }
.ch-num  { font-size: 12px; color: rgba(255,255,255,.4); min-width: 22px; flex-shrink: 0; }
.ch-logo { width: 30px; height: 30px; object-fit: contain; border-radius: 3px; flex-shrink: 0; background: rgba(255,255,255,.06); }
.ch-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.ch-badge {
  font-size: 9px; font-weight: 700; letter-spacing: .5px;
  background: rgba(255,255,255,.12); color: rgba(255,255,255,.65);
  padding: 2px 5px; border-radius: 3px; flex-shrink: 0;
}
.ch-dot  { display: none; }
.ch-thumb { display: none; } /* replaced by ch-logo */

/* ── Right area ── */
.lives-right {
  flex: 1; display: flex; flex-direction: column;
  min-width: 0; overflow: hidden;
}
.lives-video-wrap {
  /* aspect-ratio approach — always correct regardless of parent height */
  width: 100%;
  aspect-ratio: 16 / 9;
  flex-shrink: 0;
  background: #000;
  position: relative;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.lives-video-wrap video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
}

/* No-signal placeholder */
.live-no-signal {
  position: absolute; inset: 0; z-index: 2;
  background: linear-gradient(135deg, #0d1a3a 0%, #1a1a40 50%, #0d2240 100%);
  display: flex; align-items: center; justify-content: center;
}
.live-no-signal.hidden { display: none; }
.no-signal-inner { text-align: center; }
.no-signal-emoji { font-size: 64px; margin-bottom: 16px; display: block; }
.no-signal-inner h3 {
  font-size: 22px; font-weight: 700; color: #fff; margin-bottom: 8px;
}
.no-signal-inner p { font-size: 14px; color: rgba(255,255,255,.6); }

.video-spinner {
  position: absolute; inset: 0; z-index: 3;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.5);
}
.live-overlay-controls { position: absolute; bottom: 10px; right: 12px; z-index: 4; }
.live-fullscreen-btn {
  background: rgba(0,0,0,.5); border: none; color: #fff;
  font-size: 15px; padding: 6px 10px; border-radius: 4px;
  cursor: pointer; transition: background .15s;
}
.live-fullscreen-btn:hover { background: rgba(108,99,255,.7); }

/* ── EPG ── */
.lives-epg {
  flex: 1; background: var(--bg2);
  display: flex; flex-direction: column;
  min-height: 0; overflow: hidden;
}
.epg-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 16px; border-bottom: 1px solid rgba(255,255,255,.07);
  font-size: 15px; font-weight: 700; flex-shrink: 0; color: #fff;
}
.epg-fav-btn { background: none; border: none; color: var(--muted); font-size: 16px; cursor: pointer; }
.epg-fav-btn.active { color: #f00; }
.epg-list { flex: 1; overflow-y: auto; padding: 4px 0; }
.epg-list::-webkit-scrollbar { width: 3px; }
.epg-list::-webkit-scrollbar-thumb { background: var(--accent-dim); }
.epg-item {
  padding: 7px 16px; border-bottom: 1px solid rgba(255,255,255,.04);
  display: flex; align-items: baseline; gap: 12px;
}
.epg-item.current .epg-time  { color: #f5c518; font-weight: 700; }
.epg-item.current .epg-prog-title { color: #f5c518; font-weight: 700; }
.epg-time { font-size: 12px; color: rgba(255,255,255,.5); flex-shrink: 0; min-width: 115px; }
.epg-prog-title { font-size: 13px; color: rgba(255,255,255,.85); }
.epg-prog-desc { display: none; }

/* ── Legend bar ── */
.lives-legend {
  display: flex; gap: 20px; padding: 7px 14px;
  background: rgba(0,0,0,.5); flex-shrink: 0; align-items: center;
  border-top: 1px solid rgba(255,255,255,.06);
}
.legend-item { display: flex; align-items: center; gap: 7px; font-size: 13px; color: #fff; }
.legend-box { width: 16px; height: 12px; border-radius: 2px; }
.legend-blue   { background: #1565c0; }
.legend-yellow { background: #f5c518; }

/* search bar overlay */
.search-bar-overlay {
  position: absolute; top: var(--bar-h); left: 0; right: 0; z-index: 20;
  background: var(--bg2); border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex; align-items: center; padding: 8px 16px; gap: 10px;
}
.search-bar-overlay input {
  flex: 1; height: 36px; background: var(--bg4); border: none;
  color: #fff; padding: 0 12px; border-radius: 6px; font-size: 14px; outline: none;
}
.search-bar-overlay button {
  background: none; border: none; color: var(--muted); font-size: 18px; cursor: pointer;
}
#view-lives { position: relative; }

/* ============================================================
   MOVIES / SERIES BROWSE
   ============================================================ */
.browse-layout {
  flex: 1; display: flex; overflow: hidden; min-height: 0;
}

/* ── Sidebar ── */
.browse-sidebar {
  width: 230px; flex-shrink: 0;
  background: var(--bg2);
  border-right: 1px solid rgba(255,255,255,.04);
}
/* Top 4 items: Search / All / Recent Viewed / Favourites */
.sidebar-item {
  padding: 13px 18px; font-size: 16px; cursor: pointer;
  color: rgba(255,255,255,.75);
  transition: color .12s;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  line-height: 1.4; display: block;
}
.sidebar-item:hover { color: #fff; }
.sidebar-item.active { color: #e040fb; }

/* Numbered category items */
#movies-cats-list .cat-item,
#series-cats-list .cat-item {
  padding: 10px 14px; font-size: 15px;
  color: rgba(255,255,255,.75);
  border-bottom: none; background: none;
  display: flex; gap: 7px; align-items: center;
}
#movies-cats-list .cat-item .cat-num,
#series-cats-list .cat-item .cat-num {
  color: rgba(255,255,255,.35); font-size: 12px; flex-shrink: 0; min-width: 20px;
}
#movies-cats-list .cat-item .cat-dot,
#series-cats-list .cat-item .cat-dot { display: none; }
#movies-cats-list .cat-item .cat-name,
#series-cats-list .cat-item .cat-name {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Channel count badge */
.cat-count {
  font-size: 11px; color: rgba(255,255,255,.3);
  flex-shrink: 0; margin-left: auto;
}
#movies-cats-list .cat-item:hover,
#series-cats-list .cat-item:hover { background: none; color: #fff; }
#movies-cats-list .cat-item:hover .cat-count,
#series-cats-list .cat-item:hover .cat-count { color: rgba(255,255,255,.5); }
#movies-cats-list .cat-item.active,
#series-cats-list .cat-item.active { background: none; color: #e040fb; }
#movies-cats-list .cat-item.active .cat-count,
#series-cats-list .cat-item.active .cat-count { color: rgba(224,64,251,.55); }

/* ── Main area ── */
.browse-main {
  flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden;
  background: var(--bg);
}
.inline-search {
  padding: 8px 12px; border-bottom: 1px solid rgba(255,255,255,.06); flex-shrink: 0;
}
.inline-search input {
  width: 100%; height: 34px; background: var(--bg3);
  border: 1px solid rgba(255,255,255,.1);
  color: #fff; padding: 0 12px; border-radius: 6px; font-size: 13px; outline: none;
}
.inline-search input::placeholder { color: var(--muted); }

/* ── Poster grid – 4 cols × 2 rows = 8 posters fill the screen ── */
.grid-container {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  /* Each row = exactly half the available height → 2 full rows visible */
  grid-auto-rows: calc((100vh - 48px) / 2);
  gap: 10px;
  padding: 10px;
  background: var(--bg);
}
.grid-container::-webkit-scrollbar { width: 4px; }
.grid-container::-webkit-scrollbar-thumb { background: var(--accent-dim); }

.grid-item {
  cursor: pointer; overflow: hidden;
  background: var(--bg3);
  display: flex; flex-direction: column;
  height: 100%;
  border: 2px solid #b8860b;
  box-shadow: 0 0 6px rgba(184,134,11,.3);
  position: relative; z-index: 1;
  transition: transform .32s cubic-bezier(.25,.46,.45,.94),
              box-shadow .32s, border-color .2s, z-index 0s .32s;
}
.grid-item:hover {
  transform: scale(1.07) translateY(-6px);
  border-color: #ffd700;
  box-shadow: 0 24px 60px rgba(0,0,0,.9),
              0 0 0 2px #ffd700,
              0 0 28px rgba(255,215,0,.4);
  z-index: 50;
  transition: transform .32s cubic-bezier(.25,.46,.45,.94),
              box-shadow .32s, border-color .2s, z-index 0s;
}

/* Gradient overlay on hover */
.poster-wrap::after {
  content: '';
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(to bottom,
    transparent 30%, rgba(0,0,0,.5) 65%, rgba(0,0,0,.85) 100%);
  opacity: 0;
  transition: opacity .28s ease;
  pointer-events: none;
}
.grid-item:hover .poster-wrap::after { opacity: 1; }

/* Play button circle */
.poster-wrap::before {
  content: '▶';
  position: absolute; top: 50%; left: 50%; z-index: 2;
  transform: translate(-50%, -50%) scale(.4);
  width: 60px; height: 60px; line-height: 60px;
  text-align: center; font-size: 20px; color: #fff;
  background: rgba(255,255,255,.15);
  backdrop-filter: blur(6px);
  border: 2px solid rgba(255,255,255,.6);
  border-radius: 50%;
  opacity: 0;
  transition: opacity .22s ease,
              transform .3s cubic-bezier(.34,1.56,.64,1);
  pointer-events: none;
}
.grid-item:hover .poster-wrap::before {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* Poster image fills all space above the title */
.poster-wrap {
  flex: 1;               /* grows to fill row height minus title */
  position: relative;
  overflow: hidden;
  min-height: 0;
}
.poster-wrap img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  background: var(--bg3);
  display: block;
}

.grid-item-title {
  flex-shrink: 0;
  display: block; width: 100%;
  padding: 8px 10px; font-size: 14px;
  color: rgba(255,255,255,.88);
  background: var(--bg2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  line-height: 1.4; height: 36px;
}
.load-more-wrap { text-align: center; padding: 14px; flex-shrink: 0; }
.load-more-btn {
  background: var(--bg3); border: 1px solid rgba(255,255,255,.15);
  color: #fff; padding: 9px 30px; border-radius: 20px; cursor: pointer;
  font-size: 13px; transition: background .15s;
}
.load-more-btn:hover { background: var(--bg4); }

/* ============================================================
   DETAIL VIEW
   ============================================================ */
#view-detail { background: #000; }
.detail-backdrop-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center top;
  filter: blur(22px) brightness(.35);
  transform: scale(1.1);
  z-index: 0;
}
.detail-backdrop-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 0;
}

/* Top bar */
.detail-top-bar {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 24px;
  background: rgba(0,0,0,.3);
  flex-shrink: 0;
}
.detail-top-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.detail-top-icon { color: rgba(255,255,255,.6); font-size: 14px; flex-shrink: 0; }
.detail-top-title {
  font-size: 18px; font-weight: 700; color: #fff;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.detail-fav-top {
  background: none; border: none; color: rgba(255,255,255,.7);
  font-size: 22px; cursor: pointer; flex-shrink: 0; padding: 4px 8px;
  transition: color .15s;
}
.detail-fav-top.active { color: #ff4060; }
.detail-fav-top:hover { color: #ff4060; }

/* Main layout */
.detail-content {
  position: relative; z-index: 2;
  display: flex; gap: 32px; padding: 8px 28px 16px 24px;
  flex: 1; min-height: 0; overflow: hidden;
  align-items: flex-start;
}

/* Left: poster — tall, fills the marked area (starts near top bar, ends near bottom) */
.detail-poster-col {
  flex-shrink: 0;
  width: calc(70vh / 1.5);   /* width derived from height at 2:3 ratio */
  max-width: 490px;
  min-width: 220px;
  display: flex; flex-direction: column; align-items: center;
  align-self: flex-start;
}
.detail-poster-col img {
  width: 100%;
  height: 70vh;              /* fills ~70% of viewport height = matches marked area */
  object-fit: cover;
  border-radius: 10px;
  box-shadow: 0 24px 70px rgba(0,0,0,.95);
  display: block;
}
.detail-stars { margin-top: 12px; color: #f5c518; font-size: 26px; letter-spacing: 4px; }

/* Right: scrollable info */
.detail-info-col { flex: 1; min-width: 0; }

/* Metadata table */
.detail-meta-table { border-collapse: collapse; width: 100%; margin-bottom: 22px; }
.detail-meta-table tr { border-bottom: 1px solid rgba(255,255,255,.06); }
.dmt-label {
  padding: 10px 24px 10px 0; font-size: 14px; font-weight: 700;
  color: rgba(255,255,255,.95); white-space: nowrap; vertical-align: top;
  width: 150px;
}
.dmt-value {
  padding: 10px 0; font-size: 14px;
  color: rgba(255,255,255,.72); vertical-align: top;
}

/* Action buttons */
.detail-action-btns { display: flex; gap: 10px; margin-bottom: 28px; flex-wrap: wrap; }
.d-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 22px; border-radius: 5px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.22);
  color: #fff; font-size: 13px; font-weight: 700;
  letter-spacing: 1px; cursor: pointer; transition: background .15s;
}
.d-btn:hover { background: rgba(255,255,255,.2); }
.d-btn-play { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.35); }
.d-btn-play:hover { background: rgba(255,255,255,.25); }

/* TOP BILLED CAST */
.detail-cast-section { margin-bottom: 24px; }
.detail-cast-heading {
  font-size: 13px; font-weight: 700; letter-spacing: 1.5px;
  color: rgba(255,255,255,.9); margin-bottom: 14px;
}
.detail-cast-scroll {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px;
}
.detail-cast-scroll::-webkit-scrollbar { height: 5px; background: rgba(255,255,255,.08); border-radius: 3px; }
.detail-cast-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.45); border-radius: 3px; }
/* Portrait cast card — real headshot photos */
.cast-card { flex-shrink: 0; width: 165px; text-align: center; cursor: default; }
.cast-card-img {
  width: 165px; height: 185px;
  border-radius: 6px; overflow: hidden;
  background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  font-size: 56px; font-weight: 700; color: rgba(255,255,255,.55);
}
.cast-card-img img {
  width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block;
}
.cast-card-name {
  font-size: 13px; color: rgba(255,255,255,.88); margin-top: 9px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 500;
}

/* Plot */
.detail-plot-text {
  font-size: 13px; color: rgba(255,255,255,.72);
  line-height: 1.7; margin: 0 0 20px;
}

/* ── Season tabs ── */
.season-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.season-tab {
  padding: 6px 18px; border-radius: 4px;
  background: rgba(255,255,255,.1); border: none;
  color: rgba(255,255,255,.7); font-size: 13px; cursor: pointer;
  transition: background .15s, color .15s;
}
.season-tab:hover { background: rgba(255,255,255,.18); color: #fff; }
.season-tab.active { background: #f5c518; color: #000; font-weight: 700; }

/* ── Episode cards ── */
.series-episodes-section { margin-top: 6px; }
.ep-card {
  display: flex; gap: 14px;
  background: rgba(255,255,255,.05); border-radius: 8px;
  padding: 12px; margin-bottom: 10px; cursor: pointer;
  transition: background .15s;
  border: 1px solid rgba(255,255,255,.06);
}
.ep-card:hover { background: rgba(255,255,255,.1); }
.ep-thumb-wrap {
  position: relative; flex-shrink: 0;
  width: 210px; height: 118px; border-radius: 6px; overflow: hidden;
}
.ep-thumb-img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  background: var(--bg3);
}
.ep-play-btn {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.35);
  font-size: 22px; color: #fff;
  transition: background .15s;
}
.ep-card:hover .ep-play-btn { background: rgba(0,0,0,.55); }
.ep-play-btn i { filter: drop-shadow(0 2px 6px rgba(0,0,0,.8)); }
.ep-num-badge {
  position: absolute; bottom: 7px; left: 7px;
  background: #1a6fff; color: #fff;
  font-size: 11px; font-weight: 700;
  padding: 2px 7px; border-radius: 3px;
}
.ep-card-info { flex: 1; min-width: 0; }
.ep-card-title {
  font-size: 14px; font-weight: 700; color: #fff;
  margin-bottom: 8px; line-height: 1.3;
}
.ep-card-desc {
  font-size: 12px; color: rgba(255,255,255,.62); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 7;
  -webkit-box-orient: vertical; overflow: hidden;
}

/* ============================================================
   SEASONS VIEW
   ============================================================ */
#view-seasons, #view-episodes { background: var(--bg); }
.seasons-backdrop-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  filter: blur(20px) brightness(.35);
  transform: scale(1.08);
  z-index: 0;
}
.seasons-backdrop-overlay {
  position: absolute; inset: 0;
  background: rgba(10,10,18,.55);
  z-index: 0;
}
#view-seasons .content-top-bar,
#view-episodes .content-top-bar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 5;
}
.seasons-body {
  position: relative; z-index: 2;
  flex: 1; display: flex; margin-top: var(--bar-h); overflow: hidden;
}
.seasons-list {
  width: 200px; flex-shrink: 0; padding: 16px 0;
}
.season-item {
  padding: 12px 20px; font-size: 13px; font-weight: 600;
  letter-spacing: .8px; color: rgba(255,255,255,.6);
  cursor: pointer; transition: color .15s;
}
.season-item:hover { color: #fff; }
.season-item.active { color: var(--accent); }

/* ============================================================
   EPISODES VIEW
   ============================================================ */
.episodes-body {
  position: relative; z-index: 2;
  flex: 1; display: flex; margin-top: var(--bar-h); overflow: hidden;
}
.episodes-list {
  flex: 1; padding: 12px 16px; min-width: 0;
}
.ep-item {
  display: flex; gap: 16px; padding: 12px;
  background: rgba(255,255,255,.04); border-radius: 8px;
  margin-bottom: 10px; cursor: pointer;
  transition: background .15s;
}
.ep-item:hover { background: rgba(108,99,255,.18); }
.ep-thumb {
  width: 140px; height: 80px; object-fit: cover;
  border-radius: 6px; flex-shrink: 0; background: var(--bg3);
}
.ep-info { flex: 1; min-width: 0; }
.ep-title { font-size: 14px; font-weight: 600; margin-bottom: 5px; }
.ep-desc { font-size: 12px; color: var(--muted); line-height: 1.45; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ep-dur { font-size: 11px; color: var(--muted2); margin-top: 6px; display: flex; align-items: center; gap: 4px; }

/* ============================================================
   PLAYER VIEW
   ============================================================ */
#view-player { background: #000; }
#main-video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
}
.player-ui {
  position: absolute; inset: 0; z-index: 5;
  display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(180deg, rgba(0,0,0,.7) 0%, transparent 25%,
              transparent 70%, rgba(0,0,0,.8) 100%);
  transition: opacity .3s;
}
.player-ui.fade-out { opacity: 0; pointer-events: none; }
.player-top-bar {
  display: flex; align-items: center; padding: 14px 16px; gap: 12px;
}
.player-back { color: rgba(255,255,255,.9); }
.player-title { flex: 1; font-size: 15px; font-weight: 600; text-align: center; }
.player-top-right { display: flex; gap: 10px; }
.player-icon-btn {
  background: none; border: none; color: rgba(255,255,255,.8);
  font-size: 16px; cursor: pointer; padding: 5px 8px; transition: color .15s;
}
.player-icon-btn:hover { color: #fff; }
.cc-badge {
  font-size: 11px; font-weight: 700; border: 1.5px solid currentColor;
  padding: 1px 5px; border-radius: 3px; color: rgba(255,255,255,.8);
}
.player-bottom { padding: 0 16px 16px; }
.progress-wrap { padding: 8px 0; cursor: pointer; }
.progress-track {
  height: 3px; background: rgba(255,255,255,.25); border-radius: 2px;
  position: relative; transition: height .1s;
}
.progress-wrap:hover .progress-track { height: 5px; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 2px; }
.progress-thumb {
  width: 13px; height: 13px; background: #fff; border-radius: 50%;
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  box-shadow: 0 0 4px rgba(0,0,0,.6);
}
.player-controls-row {
  display: flex; align-items: center; justify-content: space-between;
}
.ctrl-left { display: flex; align-items: center; gap: 6px; }
.ctrl-right { display: flex; align-items: center; gap: 14px; }
.ctrl-btn {
  background: none; border: none; color: rgba(255,255,255,.85);
  font-size: 18px; padding: 6px 10px; cursor: pointer; transition: color .15s;
}
.ctrl-btn:hover { color: #fff; }
.ctrl-play-btn { font-size: 22px; color: #fff !important; }
.time-display { font-size: 12px; color: rgba(255,255,255,.75); font-variant-numeric: tabular-nums; }
.next-ep-btn {
  position: absolute; bottom: 20px; right: 20px; z-index: 6;
  background: rgba(108,99,255,.85); border: none; border-radius: 6px;
  color: #fff; font-size: 13px; font-weight: 600; padding: 10px 22px;
  cursor: pointer; transition: background .15s;
}
.next-ep-btn:hover { background: var(--accent); }
.player-loading {
  position: absolute; inset: 0; z-index: 7;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.4);
}
.player-error {
  position: absolute; inset: 0; z-index: 7;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: rgba(0,0,0,.8); gap: 14px;
}
.player-error i { font-size: 40px; color: #ff6060; }
.player-error span { font-size: 15px; color: rgba(255,255,255,.8); }
.player-error button {
  background: var(--accent); border: none; border-radius: 6px;
  color: #fff; padding: 8px 24px; font-size: 13px; cursor: pointer;
}

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
  background: rgba(40,40,60,.95); color: #fff;
  padding: 10px 24px; border-radius: 24px; font-size: 13px;
  z-index: 999; pointer-events: none;
  transition: opacity .3s;
  box-shadow: 0 4px 20px rgba(0,0,0,.5);
}

/* ============================================================
   SETTINGS VIEW
   ============================================================ */
#view-settings { background: var(--bg); flex-direction: column; }

.settings-top-bar {
  height: 46px; background: var(--bg2);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px; flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.settings-top-left { display: flex; align-items: center; gap: 10px; }
.stg-top-icon { color: rgba(255,255,255,.65); font-size: 15px; }
.stg-top-title { font-size: 15px; font-weight: 600; color: #fff; }
.settings-top-right { display: flex; align-items: center; gap: 14px; }
.stg-datetime { text-align: right; }
.stg-datetime span { display: block; font-size: 12px; color: rgba(255,255,255,.75); }
.stg-expiry { font-size: 11px !important; color: rgba(255,255,255,.45) !important; }
.stg-arrow-btn {
  background: none; border: none; color: rgba(255,255,255,.6);
  font-size: 18px; cursor: pointer; padding: 4px 6px;
  transition: color .15s;
}
.stg-arrow-btn:hover { color: #fff; }

.settings-grid {
  flex: 1; display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(5, 1fr);
  border-top: 1px solid rgba(255,255,255,.07);
  overflow: hidden;
}
.stg-tile {
  display: flex; align-items: center; justify-content: center;
  gap: 12px;
  border-right: 1px solid rgba(255,255,255,.07);
  border-bottom: 1px solid rgba(255,255,255,.07);
  background: var(--bg2);
  cursor: pointer;
  transition: background .15s;
  font-size: 14px; color: rgba(255,255,255,.85);
}
.stg-tile:nth-child(3n) { border-right: none; }
.stg-tile:hover { background: var(--bg3); }
.stg-tile-active { background: var(--bg3) !important; }
.stg-tile-empty { cursor: default; background: var(--bg); }
.stg-tile-empty:hover { background: var(--bg); }
.stg-tile i { font-size: 17px; color: rgba(255,255,255,.7); }

.stg-footer {
  text-align: center; padding: 10px;
  font-size: 12px; color: rgba(255,255,255,.25);
  flex-shrink: 0;
  border-top: 1px solid rgba(255,255,255,.05);
}
.stg-brand { color: var(--accent); }

/* ============================================================
   SHARED MODAL
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center;
}
.modal-card {
  background: var(--bg3); border-radius: 12px;
  width: 380px; overflow: hidden;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,.08);
  font-size: 15px; font-weight: 600; gap: 10px;
}
.modal-header button {
  background: none; border: none; color: var(--muted);
  font-size: 18px; cursor: pointer; flex-shrink: 0;
}
.modal-body { padding: 16px 20px; }

/* ── All settings modals shared styles ── */
.modal-card-wide { width: 560px; }
.sf-options { display: flex; flex-direction: column; gap: 12px; }
.sf-opt {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; color: rgba(255,255,255,.85); cursor: pointer;
  padding: 8px 12px; border-radius: 6px; transition: background .12s;
}
.sf-opt:hover { background: rgba(255,255,255,.07); }
.sf-opt input { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }

/* Settings modal rows */
.stg-status-row { margin-bottom: 12px; padding: 8px 12px; border-radius: 6px;
  background: rgba(108,99,255,.15); font-size: 13px; color: #c8b0ff; }
.stg-row { display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.06); gap: 12px; }
.stg-row label { font-size: 13px; color: rgba(255,255,255,.65); flex-shrink: 0; }
.stg-row input { flex: 1; height: 36px; background: var(--bg4); border: 1px solid rgba(255,255,255,.12);
  color: #fff; padding: 0 12px; border-radius: 6px; font-size: 14px; outline: none;
  letter-spacing: 4px; max-width: 180px; }
.stg-row input::placeholder { letter-spacing: 0; color: var(--muted); }
.stg-select { flex: 1; max-width: 200px; height: 36px; background: var(--bg4);
  border: 1px solid rgba(255,255,255,.12); color: #fff; padding: 0 10px;
  border-radius: 6px; font-size: 13px; outline: none; cursor: pointer; }
.stg-hint { font-size: 12px; color: var(--muted); margin-bottom: 14px; line-height: 1.5; }

/* Settings buttons */
.stg-btns { display: flex; gap: 10px; margin-top: 16px; }
.stg-btn {
  flex: 1; padding: 10px; border-radius: 6px; border: none;
  font-size: 13px; font-weight: 600; cursor: pointer; transition: opacity .15s;
  background: rgba(255,255,255,.1); color: #fff; display: flex; align-items: center;
  justify-content: center; gap: 7px;
}
.stg-btn:hover { opacity: .85; }
.stg-btn-primary { background: var(--accent); }
.stg-btn-danger  { background: rgba(220,50,50,.7); }

/* Settings tabs (hide category) */
.stg-tabs-row { display: flex; gap: 6px; margin-bottom: 14px; }
.stg-tab-btn {
  padding: 7px 18px; border-radius: 20px; border: 1px solid rgba(255,255,255,.15);
  background: none; color: rgba(255,255,255,.65); font-size: 13px; cursor: pointer;
}
.stg-tab-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Hide category list */
.hide-cat-list { max-height: 280px; overflow-y: auto; margin-bottom: 6px; }
.hide-cat-list::-webkit-scrollbar { width: 3px; }
.hide-cat-list::-webkit-scrollbar-thumb { background: var(--accent-dim); }
.hide-cat-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 4px;
  border-bottom: 1px solid rgba(255,255,255,.04); cursor: pointer;
}
.hide-cat-item input { width: 16px; height: 16px; accent-color: #e040fb; cursor: pointer; }
.hide-cat-item label { font-size: 13px; color: rgba(255,255,255,.8); cursor: pointer; flex: 1; }

/* Subtitle preview */
.sub-preview {
  margin-top: 16px; padding: 14px; text-align: center;
  border-radius: 6px; background: rgba(0,0,0,.5);
  font-size: 18px; color: #fff; font-weight: 600;
  border: 1px solid rgba(255,255,255,.1);
}

/* Support modal */
.support-info { text-align: center; }
.support-logo { margin-bottom: 10px; }
.support-name { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.support-version { font-size: 12px; color: var(--muted); margin-bottom: 18px; }
.support-rows { text-align: left; }
.stg-modal-close {
  background: none; border: none; color: var(--muted);
  font-size: 18px; cursor: pointer; flex-shrink: 0;
}

/* ============================================================
   NO RESULTS / LOADING PLACEHOLDERS
   ============================================================ */
.no-results {
  color: var(--muted); text-align: center; padding: 40px;
  font-size: 14px; grid-column: 1/-1;
}
.loading-text {
  color: var(--muted2); text-align: center; padding: 30px;
  font-size: 13px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* ── Large TV (≥1920px) ── */
@media (min-width: 1920px) {
  :root { --bar-h: 56px; }
  .sidebar-item { font-size: 17px; padding: 14px 20px; }
  #movies-cats-list .cat-item,
  #series-cats-list .cat-item { font-size: 16px; padding: 11px 16px; }
  .grid-item-title { font-size: 15px; height: 38px; }
  .home-cards { padding: 48px; gap: 18px; }
  .card-title { font-size: 20px; }
  .stg-tile { font-size: 16px; }
  .stg-tile i { font-size: 20px; }
}

/* ── Tablet (≤1024px) ── */
@media (max-width: 1024px) {
  .browse-sidebar { width: 190px; }
  .grid-container { grid-template-columns: repeat(3, 1fr); }
  .lives-categories { width: 160px; }
  .lives-channels { width: 185px; }
  .detail-poster-col { width: min(calc(60vh / 1.5), 380px); }
  .detail-poster-col img { height: 60vh; }
}

/* ── Small tablet / large phone (≤768px) ── */
@media (max-width: 768px) {
  :root { --bar-h: 44px; }
  .browse-sidebar { width: 160px; }
  #movies-cats-list .cat-item,
  #series-cats-list .cat-item { font-size: 13px; }
  .grid-container { grid-template-columns: repeat(2, 1fr); gap: 6px; padding: 6px; }
  .grid-container { grid-auto-rows: calc((100vh - 44px) / 2); }
  .lives-categories { width: 130px; }
  .lives-channels { width: 160px; }
  .detail-content { flex-direction: column; gap: 16px; }
  .detail-poster-col { width: 100%; max-width: 260px; align-self: center; }
  .detail-poster-col img { height: auto; max-height: 55vw; }
  .home-cards { padding: 16px; gap: 8px; }
  .card-title { font-size: 14px; }
  .login-content { flex-direction: column; gap: 24px; padding: 24px; }
  .login-logo-img { width: 130px; height: 130px; }
}

/* ── Mobile phone (≤480px) ── */
@media (max-width: 480px) {
  .browse-sidebar { width: 130px; }
  .sidebar-item { font-size: 13px; padding: 10px 12px; }
  #movies-cats-list .cat-item,
  #series-cats-list .cat-item { font-size: 12px; padding: 8px 10px; }
  .grid-container { grid-template-columns: repeat(2, 1fr); }
  .lives-channels { display: none; }
  .home-cards { flex-direction: column; padding: 12px; }
  .content-tabs .tab { font-size: 11px; padding: 6px 10px; }
  .dmt-label, .dmt-value { font-size: 12px; }
  .d-btn { padding: 8px 14px; font-size: 12px; }
}
