:root {
  --bg-root: #06100a;
  --bg-surface: #0c1d12;
  --bg-elevated: #132b1b;
  --lemon: #a3e635;
  --lemon-hover: #bef264;
  --text-primary: #f2f8f4;
  --text-secondary: #98b5a2;
  --text-muted: #62806d;
  --border: rgba(163, 230, 53, 0.14);
  --border-strong: rgba(163, 230, 53, 0.36);
  --success: #a3e635;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --sidebar-w: 84px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body, input, select, button, textarea {
  font-family: 'Urbanist', -apple-system, BlinkMacSystemFont, sans-serif;
}

html, body {
  width: 100%;
  height: 100%;
  background: var(--bg-root);
  color: var(--text-primary);
  overflow: hidden;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

.material-symbols-rounded {
  font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24;
  font-size: 20px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

.material-symbols-rounded.filled {
  font-variation-settings: 'FILL' 1, 'wght' 600, 'GRAD' 0, 'opsz' 24;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.hidden {
  display: none !important;
}

.app-shell {
  display: grid;
  grid-template-columns: calc(var(--sidebar-w) + var(--safe-left)) 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "topbar topbar"
    "sidebar main";
  width: 100vw;
  height: 100dvh;
}

/* TOPBAR (Safe-Area Protected) */
.topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: calc(64px + var(--safe-top));
  padding: calc(10px + var(--safe-top)) calc(20px + var(--safe-right)) 10px calc(20px + var(--safe-left));
  background: var(--bg-root);
  border-bottom: 1px solid var(--border);
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  flex-shrink: 0;
}

.brand-logo-round {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: #0f2419;
  border: 1px solid var(--border-strong);
}

.brand-logo-round img, .brand-logo-round svg {
  width: 100%;
  height: 100%;
  display: block;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--lemon);
  line-height: 1.05;
}

.brand-badge {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-secondary);
}

.search-wrap {
  position: relative;
  flex: 1;
  max-width: 540px;
  min-width: 0;
}

.search-wrap input {
  width: 100%;
  height: 40px;
  padding: 0 36px 0 40px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--text-primary);
  font-size: 0.92rem;
  font-weight: 500;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.search-wrap input:focus {
  outline: none;
  border-color: var(--border-strong);
  background: var(--bg-elevated);
}

.search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: var(--text-secondary);
  pointer-events: none;
}

.clear-search-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 13px;
  border-radius: 99px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.pill-btn:hover {
  border-color: var(--border-strong);
  background: var(--bg-elevated);
}

.btn-xs {
  height: 32px;
  padding: 0 11px;
  font-size: 0.78rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s ease;
}

.icon-btn:hover {
  color: #fff;
  border-color: var(--border-strong);
  background: var(--bg-elevated);
}

/* SIDEBAR */
.sidebar {
  grid-area: sidebar;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 8px calc(16px + var(--safe-bottom)) calc(8px + var(--safe-left));
  gap: 8px;
  background: var(--bg-root);
  border-right: 1px solid var(--border);
  z-index: 30;
}

.nav-item {
  width: 68px;
  height: 60px;
  border-radius: var(--radius-md);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s ease;
}

.nav-item .material-symbols-rounded {
  font-size: 22px;
}

.nav-item:hover {
  color: var(--lemon);
  background: var(--bg-surface);
}

.nav-item.active {
  color: var(--lemon);
  background: var(--bg-elevated);
  border-color: var(--border-strong);
}

.nav-item.active .material-symbols-rounded {
  font-variation-settings: 'FILL' 1, 'wght' 600, 'GRAD' 0, 'opsz' 24;
  color: var(--lemon);
}

/* MAIN CONTENT */
.main-content {
  grid-area: main;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 var(--safe-right) calc(48px + var(--safe-bottom)) 0;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.view-section {
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.section-pad {
  margin: 16px 24px 12px;
}

/* HERO BANNER — Clean artwork with pure black fade only */
.hero-banner {
  position: relative;
  min-height: 360px;
  margin: 18px 24px 10px;
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: 32px 34px;
  border: 1px solid var(--border);
  background: #050506;
}

.hero-backdrop {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 20%;
}

.hero-gradient {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.92) 0%, rgba(0, 0, 0, 0.58) 46%, rgba(0, 0, 0, 0.04) 100%),
    linear-gradient(0deg, rgba(0, 0, 0, 0.92) 0%, rgba(0, 0, 0, 0) 60%);
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 580px;
}

.hero-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(18, 18, 21, 0.92);
  border: 1px solid var(--border);
  color: #fff;
}

.badge-tag.accent {
  background: var(--lemon);
  color: #07110c;
  border-color: var(--lemon);
}

.badge-tag.imdb {
  background: rgba(13, 29, 20, 0.92);
  color: var(--lemon);
  border-color: var(--border-strong);
}

.hero-logo-wrap img {
  max-height: 70px;
  max-width: 280px;
  object-fit: contain;
  margin-bottom: 10px;
}

.hero-title {
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1.12;
  margin-bottom: 10px;
}

.hero-synopsis {
  font-size: 0.95rem;
  line-height: 1.55;
  color: #d4d4d8;
  margin-bottom: 20px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* BUTTONS — Solid clean matte buttons */
.btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border-radius: 99px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.16s ease;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--lemon);
  color: #07110c;
}

.btn-primary:hover {
  background: var(--lemon-hover);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  background: var(--bg-elevated);
  border-color: var(--lemon);
}

.btn-sm {
  height: 36px;
  padding: 0 15px;
  font-size: 0.84rem;
}

/* BOARD ROWS */
.board-rows {
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 14px 24px;
}

.catalog-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.row-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.row-count {
  font-size: 0.76rem;
  color: var(--text-secondary);
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 99px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
}

.row-see-all {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.row-see-all:hover {
  color: #fff;
}

.row-scroller {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 4px 2px 10px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

/* POSTER CARD — 100% clean poster artwork */
.poster-card {
  flex: 0 0 162px;
  width: 162px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  cursor: pointer;
  scroll-snap-align: start;
  position: relative;
}

.poster-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.poster-card:hover .poster-thumb-wrap {
  transform: translateY(-4px);
  border-color: var(--lemon);
}

.poster-img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.poster-fallback {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px;
  text-align: center;
  background: #141418;
  font-weight: 700;
  font-size: 0.94rem;
  color: var(--text-primary);
}

.poster-hover-play {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: rgba(0, 0, 0, 0.52);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.poster-card:hover .poster-hover-play {
  opacity: 1;
}

.play-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--lemon);
  color: #07110c;
  display: flex;
  align-items: center;
  justify-content: center;
}

.poster-top-badge {
  position: absolute;
  z-index: 2;
  top: 8px;
  left: 8px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.66rem;
  font-weight: 700;
  background: rgba(9, 9, 11, 0.88);
  color: #f4f4f6;
  border: 1px solid rgba(255,255,255,0.12);
}

.poster-rating-badge {
  position: absolute;
  z-index: 2;
  top: 8px;
  right: 8px;
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 0.66rem;
  font-weight: 800;
  background: rgba(6, 16, 10, 0.9);
  color: var(--lemon);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.poster-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.poster-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* CONTINUE WATCHING CARDS */
.continue-card {
  flex: 0 0 260px;
  width: 260px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.continue-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-3px);
}

.continue-thumb {
  position: relative;
  height: 134px;
  background-size: cover;
  background-position: center;
  background-color: #16161a;
  display: flex;
  align-items: center;
  justify-content: center;
}

.continue-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.82) 0%, rgba(0, 0, 0, 0.15) 65%);
}

.continue-thumb .play-circle {
  position: relative;
  z-index: 2;
  width: 42px;
  height: 42px;
}

.continue-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  z-index: 3;
}

.continue-progress-fill {
  height: 100%;
  background: var(--lemon);
}

.continue-body {
  padding: 10px 12px;
}

.continue-series {
  font-size: 0.88rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.continue-ep {
  font-size: 0.76rem;
  color: var(--text-secondary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* DISCOVER / GRID VIEW */
.discover-header, .folders-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  padding: 22px 24px 14px;
}

.section-heading {
  font-size: 1.44rem;
  font-weight: 800;
}

.section-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 3px;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-pill {
  height: 34px;
  padding: 0 13px;
  border-radius: 99px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s ease;
}

.filter-pill.active, .filter-pill:hover {
  background: var(--lemon);
  color: #07110c;
  border-color: var(--lemon);
}

.stremio-select, .stremio-input, .stremio-input-sm {
  height: 38px;
  padding: 0 13px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 0.86rem;
}

.stremio-input {
  width: 100%;
  height: 42px;
}

.stremio-input-sm {
  height: 32px;
  font-size: 0.8rem;
  width: 175px;
}

.poster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(154px, 1fr));
  gap: 20px 14px;
  padding: 10px 24px 40px;
}

.poster-grid .poster-card {
  width: 100%;
  flex: none;
}

.continue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  padding: 0 24px;
}

.continue-grid .continue-card {
  width: 100%;
}

/* FOLDERS EXPLORER */
.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 24px 16px;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.crumb-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.crumb-btn:hover, .crumb-btn.active {
  color: #fff;
  background: var(--bg-elevated);
}

.crumb-sep {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.folder-explorer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  padding: 0 24px 40px;
}

.drive-item-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.16s ease;
}

.drive-item-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-elevated);
  transform: translateY(-2px);
}

.drive-item-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--bg-elevated);
  color: #fff;
}

.drive-item-info {
  flex: 1;
  min-width: 0;
}

.drive-item-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drive-item-sub {
  font-size: 0.76rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* DETAIL MODAL / DRAWER — Pure black fade + Safe Areas */
.detail-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: #050506;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.2s ease;
}

.detail-backdrop {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.4;
}

.detail-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(5, 5, 6, 0.96) 0%, rgba(5, 5, 6, 0.8) 45%, rgba(5, 5, 6, 0.94) 100%),
    linear-gradient(0deg, rgba(5, 5, 6, 0.98) 0%, rgba(5, 5, 6, 0.25) 65%);
}

.detail-topbar {
  position: relative;
  z-index: 3;
  padding: calc(16px + var(--safe-top)) calc(24px + var(--safe-right)) 0 calc(24px + var(--safe-left));
}

.detail-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border-radius: 99px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  color: #fff;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
}

.detail-layout {
  position: relative;
  z-index: 3;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(290px, 420px) 1fr;
  gap: 28px;
  padding: 18px calc(24px + var(--safe-right)) calc(24px + var(--safe-bottom)) calc(24px + var(--safe-left));
  min-height: 0;
}

.detail-meta-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  overflow-y: auto;
  padding-right: 6px;
}

.detail-logo-area img {
  max-height: 86px;
  max-width: 300px;
  object-fit: contain;
}

.detail-title {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.12;
}

.detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-synopsis {
  font-size: 0.94rem;
  line-height: 1.6;
  color: #d4d4d8;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 4px;
}

.detail-episodes-col {
  background: rgba(14, 14, 17, 0.94);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.episodes-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: #121215;
}

.season-selector-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.episodes-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.episodes-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  -webkit-overflow-scrolling: touch;
}

.episode-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.16s ease;
}

.episode-row:hover {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
}

.episode-row.watched {
  opacity: 0.72;
}

.ep-thumb {
  width: 96px;
  height: 54px;
  border-radius: 8px;
  object-fit: cover;
  background: #1a1a20;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.ep-num-badge {
  min-width: 54px;
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: #fff;
  font-weight: 800;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ep-info {
  flex: 1;
  min-width: 0;
}

.ep-title {
  font-size: 0.93rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ep-sub {
  font-size: 0.76rem;
  color: var(--text-secondary);
  margin-top: 3px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.ep-play-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--lemon);
  color: #07110c;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* VIDEO PLAYER MODAL (3 MODES + CUSTOM HUD + AUTO-HIDE TOPBAR) */
.player-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: #000;
  display: block;
  overflow: hidden;
}

.player-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  min-height: calc(58px + var(--safe-top));
  padding: calc(10px + var(--safe-top)) calc(18px + var(--safe-right)) 14px calc(18px + var(--safe-left));
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.88) 0%, rgba(0, 0, 0, 0) 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  z-index: 25;
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.player-topbar.topbar-idle {
  opacity: 0;
  transform: translateY(-100%);
  pointer-events: none;
}

.show-player-topbar-btn {
  position: absolute;
  top: calc(10px + var(--safe-top));
  left: calc(12px + var(--safe-left));
  z-index: 24;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(6, 16, 10, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.show-player-topbar-btn:hover {
  background: rgba(6, 16, 10, 0.85);
  color: #fff;
}

.player-back-btn, .player-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border-radius: 99px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.player-mode-group {
  display: inline-flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 3px;
  gap: 2px;
}

.player-mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 11px;
  border-radius: 99px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.player-mode-pill .material-symbols-rounded {
  font-size: 16px;
}

.player-mode-pill.active {
  background: var(--lemon);
  color: #07110c;
}

.player-title-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-width: 0;
  flex: 1;
}

.player-series-name {
  font-size: 0.74rem;
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.player-episode-name {
  font-size: 0.92rem;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.player-top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.player-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.stremio-video, .drive-embed-frame {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  background: #000;
}

/* NERDFLIX CUSTOM PLAYER HUD */
.nf-hud {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0) 38%);
  transition: opacity 0.22s ease;
}

.nf-hud.hud-idle {
  opacity: 0;
  pointer-events: none;
}

.nf-center-controls {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 24px;
}

.nf-circle-btn {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(15, 15, 18, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.nf-circle-btn .material-symbols-rounded {
  font-size: 28px;
}

.nf-circle-btn.nf-play-main {
  width: 68px;
  height: 68px;
  background: var(--lemon);
  color: #07110c;
  border: none;
}

.nf-circle-btn.nf-play-main .material-symbols-rounded {
  font-size: 36px;
}

.nf-circle-btn:active {
  transform: scale(0.93);
}

.nf-bottom-bar {
  width: 100%;
  padding: 12px calc(20px + var(--safe-right)) calc(14px + var(--safe-bottom)) calc(20px + var(--safe-left));
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nf-timeline-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nf-time-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #e4e4e7;
  min-width: 44px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.nf-seek-wrap {
  flex: 1;
  display: flex;
  align-items: center;
}

.nf-seek-slider, .nf-vol-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.26);
  outline: none;
  cursor: pointer;
}

.nf-seek-slider::-webkit-slider-thumb, .nf-vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--lemon);
  cursor: pointer;
}

.nf-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.nf-controls-left, .nf-controls-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nf-volume-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nf-vol-slider {
  width: 80px;
}

.nf-icon-btn, .nf-text-btn {
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
}

.nf-icon-btn:hover, .nf-text-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

.up-next-toast {
  position: absolute;
  right: calc(22px + var(--safe-right));
  bottom: calc(92px + var(--safe-bottom));
  background: #121215;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 20;
  min-width: 260px;
}

.up-next-text span {
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.up-next-text p {
  font-size: 0.94rem;
  font-weight: 700;
  color: #fff;
  margin-top: 3px;
}

.up-next-btns {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* SETTINGS */
.settings-container {
  max-width: 760px;
  padding: 22px 24px 50px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.settings-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}

.settings-card h3 {
  font-size: 1.04rem;
  margin-bottom: 6px;
}

.settings-help {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.input-row, .oauth-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.input-row .stremio-input {
  flex: 1;
  min-width: 200px;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.form-grid label span, .custom-modal-box label span {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 5px;
  font-weight: 600;
}

.badge-pill {
  padding: 6px 12px;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(34, 197, 94, 0.14);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

/* CUSTOM COVER & TMDB SEARCH MODAL */
.custom-modal {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(0, 0, 0, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.custom-modal-box {
  width: 100%;
  max-width: 500px;
  max-height: 90dvh;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.tmdb-results-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
  margin-bottom: 10px;
}

.tmdb-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  cursor: pointer;
}

.tmdb-result-item:hover {
  border-color: #fff;
}

.tmdb-result-item img {
  width: 36px;
  height: 54px;
  object-fit: cover;
  border-radius: 4px;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}

/* =========================================================
   MOBILE & APK TOTAL RESPONSIVENESS + SAFE AREAS
   ========================================================= */
@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
      "topbar"
      "main"
      "sidebar";
  }

  .topbar {
    padding: calc(8px + var(--safe-top)) calc(12px + var(--safe-right)) 8px calc(12px + var(--safe-left));
    min-height: calc(56px + var(--safe-top));
    gap: 8px;
  }

  .brand-logo-round {
    width: 36px;
    height: 36px;
  }

  .brand-title {
    font-size: 1.05rem;
  }

  .brand-badge {
    display: none;
  }

  .search-wrap input {
    height: 36px;
    font-size: 0.85rem;
    padding: 0 30px 0 34px;
  }

  .search-icon {
    left: 10px;
    font-size: 17px;
  }

  .pill-label, .hide-xs {
    display: none !important;
  }

  .pill-btn {
    padding: 0 10px;
    height: 34px;
  }

  .icon-btn {
    width: 34px;
    height: 34px;
  }

  .sidebar {
    flex-direction: row;
    justify-content: space-around;
    padding: 6px calc(6px + var(--safe-right)) calc(6px + var(--safe-bottom)) calc(6px + var(--safe-left));
    border-right: none;
    border-top: 1px solid var(--border);
  }

  .nav-item {
    width: auto;
    flex: 1;
    height: 50px;
    font-size: 0.68rem;
    gap: 2px;
  }

  .hero-banner {
    min-height: 270px;
    margin: 10px 12px 6px;
    padding: 18px 16px;
    border-radius: 14px;
  }

  .hero-logo-wrap img {
    max-height: 50px;
    max-width: 210px;
  }

  .hero-title {
    font-size: 1.45rem;
  }

  .hero-synopsis {
    font-size: 0.84rem;
    -webkit-line-clamp: 2;
    margin-bottom: 14px;
  }

  .btn-primary, .btn-secondary {
    height: 38px;
    padding: 0 15px;
    font-size: 0.84rem;
  }

  .board-rows {
    padding: 10px 12px 24px;
    gap: 20px;
  }

  .row-title {
    font-size: 1.02rem;
  }

  .poster-card {
    flex: 0 0 124px;
    width: 124px;
  }

  .poster-grid {
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    padding: 8px 12px 30px;
    gap: 14px 10px;
  }

  .discover-header, .folders-header {
    padding: 16px 12px 10px;
    gap: 10px;
  }

  .section-heading {
    font-size: 1.22rem;
  }

  .breadcrumbs, .continue-grid, .folder-explorer-grid, .settings-container {
    padding-left: 12px;
    padding-right: 12px;
    margin-left: 0;
    margin-right: 0;
  }

  /* Responsive Mobile Detail Drawer */
  .detail-modal {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .detail-topbar {
    padding: calc(12px + var(--safe-top)) 14px 0;
  }

  .detail-layout {
    display: flex;
    flex-direction: column;
    padding: 12px 14px calc(28px + var(--safe-bottom));
    gap: 16px;
    overflow: visible;
  }

  .detail-meta-col {
    overflow: visible;
    padding-right: 0;
    gap: 10px;
  }

  .detail-title {
    font-size: 1.5rem;
  }

  .detail-synopsis {
    font-size: 0.86rem;
  }

  .detail-episodes-col {
    overflow: visible;
    min-height: 340px;
  }

  .episodes-panel-header {
    padding: 12px;
  }

  .episodes-toolbar {
    width: 100%;
    justify-content: space-between;
  }

  .stremio-input-sm {
    flex: 1;
    width: auto;
  }

  .episodes-list {
    max-height: none;
    overflow: visible;
    padding: 10px;
  }

  .ep-thumb {
    width: 78px;
    height: 46px;
  }

  /* Responsive Mobile Player */
  .player-topbar {
    flex-wrap: wrap;
    padding: calc(8px + var(--safe-top)) 10px 8px;
    gap: 6px;
  }

  .player-title-info {
    order: -1;
    width: 100%;
    flex: none;
    margin-bottom: 2px;
  }

  .player-mode-pill {
    padding: 0 9px;
    font-size: 0.74rem;
    height: 28px;
  }

  .nf-center-controls {
    gap: 16px;
  }

  .nf-circle-btn {
    width: 46px;
    height: 46px;
  }

  .nf-circle-btn.nf-play-main {
    width: 58px;
    height: 58px;
  }

  .nf-bottom-bar {
    padding: 10px calc(12px + var(--safe-right)) calc(12px + var(--safe-bottom)) calc(12px + var(--safe-left));
  }
}
