/* Final Movie Database interface layer */
:root {
  --bg: #060a12;
  --panel: rgba(10, 16, 28, .78);
  --panel-soft: rgba(16, 24, 39, .76);
  --text: #f8fafc;
  --muted: #9aa6ba;
  --line: rgba(132, 163, 214, .18);
  --accent: #4f8fff;
  --accent-strong: #168cff;
  --accent-2: #8bb8ff;
  --danger: #ff7474;
}

body {
  background:
    radial-gradient(circle at 20% 0%, rgba(44, 125, 255, .2), transparent 26rem),
    radial-gradient(circle at 95% 18%, rgba(114, 96, 255, .12), transparent 24rem),
    linear-gradient(180deg, #060a12 0%, #08101d 52%, #060a12 100%);
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body::before {
  background-image:
    linear-gradient(90deg, rgba(120, 157, 220, .12) 1px, transparent 1px),
    linear-gradient(180deg, rgba(120, 157, 220, .06) 1px, transparent 1px);
  background-size: 28px 28px;
  background-position: 0 0;
  opacity: .34;
}

.app-shell {
  gap: 16px;
  min-height: 100dvh;
  padding-bottom: 160px;
  width: min(1040px, 100%);
  overflow-x: hidden;
}

* {
  min-width: 0;
}

.desktop-header {
  background: rgba(7, 11, 20, .72);
  border-color: rgba(142, 171, 220, .14);
  backdrop-filter: blur(22px) saturate(1.35);
  -webkit-backdrop-filter: blur(22px) saturate(1.35);
  transition: transform .22s ease, opacity .22s ease, top .22s ease;
  will-change: transform, top;
}

.desktop-header.header-hidden {
  opacity: .98;
  top: -140px !important;
  transform: translateX(-50%) translateY(-110%) !important;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.notification-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  min-height: 46px;
  border: 1px solid rgba(148, 178, 230, .16);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .02)),
    rgba(9, 15, 27, .74);
  color: white;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
}

.notification-bell.active {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .28), rgba(255, 255, 255, .08)),
    rgba(79, 143, 255, .78);
}

.notification-bell .nav-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  margin: 0;
}

.home-hero::before {
  content: none !important;
  display: none !important;
}

.home-hero {
  min-height: auto !important;
  align-content: center !important;
  gap: 28px !important;
  padding: clamp(24px, 6vw, 54px) !important;
  background:
    linear-gradient(135deg, rgba(79, 143, 255, .2), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, .065), rgba(255, 255, 255, .02)),
    rgba(9, 15, 27, .74) !important;
  backdrop-filter: blur(18px) saturate(1.28);
  -webkit-backdrop-filter: blur(18px) saturate(1.28);
}

.global-search,
.search-row,
.torrent-filter,
.live-search {
  position: relative;
  min-width: 0;
  max-width: 100%;
}

.media-grid,
.stats-grid,
.hero-strip,
.info-grid,
.action-row,
.single-action,
.settings-form,
.settings-actions,
.settings-card,
.status-alert,
.bulk-action,
.bulk-panel,
.season-list,
.episode-list,
.search-results,
.torrent-list,
.notification-list {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.media-card,
.search-card,
.torrent-card,
.season-row,
.episode-row,
.notification-card,
.detail-hero,
.overview,
.cast-list,
.progress-box,
.empty-card,
.settings-card,
.status-alert,
.bulk-action,
.bulk-panel,
.topbar,
.home-hero {
  max-width: 100%;
}

.live-results {
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: hidden;
}

.live-result,
.search-card {
  min-width: 0;
}

.live-result-copy,
.search-copy,
.media-meta {
  min-width: 0;
}

.live-result-copy strong,
.live-result-copy span,
.live-result-copy p,
.search-copy strong,
.search-copy span,
.search-copy p,
.media-meta h3,
.media-meta p,
.detail-copy h1,
.detail-copy p,
.info-grid strong,
.info-grid span {
  overflow-wrap: anywhere;
}

.detail-hero {
  grid-template-columns: minmax(96px, 128px) minmax(0, 1fr) !important;
}

.detail-copy {
  min-width: 0;
}

.hero-copy {
  text-align: left !important;
}

.hero-copy h1 {
  margin: 0 !important;
  font-size: clamp(38px, 7vw, 72px) !important;
  line-height: 1 !important;
}

.hero-copy p:last-child {
  margin: 18px 0 0 !important;
  max-width: 700px !important;
  font-size: clamp(16px, 2.5vw, 22px) !important;
}

.floating-action {
  display: none !important;
}

.top-nav-link,
.logout-link,
.global-search,
.search-row,
.torrent-filter,
.topbar,
.home-hero,
.detail-hero,
.media-card,
.search-card,
.torrent-card,
.season-row,
.episode-row,
.notification-card,
.overview,
.cast-list,
.info-grid > div,
.progress-box,
.empty-card,
.stat-card,
.hero-strip > div,
.hero-strip > a,
.single-action,
.settings-card,
.status-alert,
.bulk-action,
.bulk-panel,
.live-results {
  border: 1px solid rgba(148, 178, 230, .16) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .02)),
    rgba(9, 15, 27, .74) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .08),
    0 18px 50px rgba(0, 0, 0, .22) !important;
  backdrop-filter: blur(18px) saturate(1.28);
  -webkit-backdrop-filter: blur(18px) saturate(1.28);
}

.topbar {
  min-height: 116px;
  padding: 22px;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  overflow: hidden;
}

.topbar h1 {
  color: white;
  font-size: clamp(30px, 6vw, 58px);
  line-height: 1;
  overflow-wrap: anywhere;
}

.topbar form,
.topbar .mini-button,
.topbar button {
  max-width: 100%;
}

.single-action {
  padding: 10px;
}

.single-action .wide-button {
  width: 100%;
}

.settings-form {
  display: grid;
  gap: 14px;
}

.settings-actions,
.preset-row,
.bulk-action {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.bulk-panel {
  padding: 10px;
}

.bulk-panel summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border-radius: 16px;
  color: white;
  font-weight: 900;
  list-style: none;
}

.bulk-panel summary::-webkit-details-marker {
  display: none;
}

.bulk-panel[open] summary {
  margin-bottom: 10px;
  background: rgba(87, 152, 255, .18);
}

.bulk-panel .bulk-action {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  padding: 0;
}

.settings-actions .mini-button,
.preset-row .mini-button,
.bulk-action .mini-button {
  flex: 1 1 130px;
}

.settings-card,
.status-alert {
  padding: 18px;
}

.settings-card {
  display: grid;
  gap: 12px;
}

.settings-card h2,
.status-alert strong {
  color: white;
  margin: 0;
}

.settings-card label {
  display: grid;
  gap: 8px;
}

.settings-card label span {
  color: rgba(217, 226, 242, .68);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .12em;
}

.settings-card input {
  width: 100%;
  height: 54px;
  border: 1px solid rgba(148, 178, 230, .18);
  border-radius: 14px;
  background: rgba(3, 8, 16, .58);
  color: white;
  padding: 0 14px;
}

.inline-check {
  display: flex !important;
  align-items: center;
  gap: 10px;
}

.inline-check input {
  width: 20px !important;
  height: 20px !important;
  flex: 0 0 auto;
}

.inline-check span {
  text-transform: none !important;
  letter-spacing: 0 !important;
}

.settings-card p,
.status-alert p {
  margin: 0;
  color: rgba(217, 226, 242, .72);
  line-height: 1.35;
}

.settings-card code {
  color: rgba(139, 185, 255, .95);
}

.status-alert {
  display: grid;
  gap: 6px;
  border-color: rgba(148, 178, 230, .22) !important;
}

.status-alert.success {
  border-color: rgba(98, 210, 132, .45) !important;
}

.status-alert.danger {
  border-color: rgba(255, 102, 118, .5) !important;
}

input,
select {
  min-width: 0;
}

.torrent-filter {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(120px, .55fr) minmax(140px, .75fr) auto;
  gap: 12px;
  padding: 14px;
  align-items: end;
}

.torrent-filter label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.torrent-filter span {
  color: rgba(217, 226, 242, .68);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .12em;
}

.torrent-filter input,
.torrent-filter select {
  width: 100%;
  height: 52px;
  border: 1px solid rgba(148, 178, 230, .18);
  border-radius: 14px;
  background: rgba(3, 8, 16, .58);
  color: white;
  padding: 0 14px;
}

.torrent-list {
  display: grid;
  gap: 12px;
}

.torrent-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 16px;
  align-items: center;
}

.torrent-copy {
  min-width: 0;
  display: grid;
  gap: 9px;
}

.torrent-copy a {
  color: white;
  text-decoration: none;
}

.torrent-copy strong {
  display: block;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.torrent-copy p {
  margin: 0;
  color: rgba(217, 226, 242, .72);
  line-height: 1.35;
}

.torrent-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.torrent-meta span {
  border: 1px solid rgba(137, 177, 255, .18);
  border-radius: 999px;
  padding: 6px 9px;
  color: rgba(232, 238, 249, .82);
  background: rgba(7, 13, 24, .46);
  font-size: 13px;
  font-weight: 800;
}

.magnet-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  text-align: center;
}

button,
.wide-button,
.ghost-link,
.icon-button,
.mini-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1px solid rgba(137, 177, 255, .25);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .18), rgba(255, 255, 255, .05)),
    linear-gradient(180deg, #5798ff, #3977ea);
}

.secondary,
.ghost-link,
.pill {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .02)),
    rgba(13, 21, 35, .76);
}

.media-card,
.search-card,
.torrent-card,
.season-row,
.episode-row,
.notification-card {
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

.media-card:hover,
.search-card:hover,
.torrent-card:hover,
.season-row:hover,
.episode-row:hover,
.notification-card:hover {
  transform: translateY(-2px);
  border-color: rgba(98, 154, 255, .46) !important;
}

.selectable-card {
  position: relative;
}

.media-card-link {
  display: block;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.select-check {
  position: absolute;
  z-index: 3;
  top: 12px;
  left: 12px;
  display: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: rgba(0, 0, 0, .72);
  border: 1px solid rgba(255, 255, 255, .32);
}

.select-check input {
  width: 22px;
  height: 22px;
  accent-color: #5798ff;
}

body.bulk-selecting .select-check {
  display: flex;
}

.select-all {
  flex: 1 1 150px;
}

.bottom-nav {
  bottom: 14px !important;
  width: min(560px, calc(100% - 24px)) !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 6px !important;
  padding: 8px !important;
  border: 1px solid rgba(210, 226, 255, .24) !important;
  border-radius: 28px !important;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, .06) 45%, rgba(255, 255, 255, .12)),
    rgba(10, 16, 28, .54) !important;
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, .42),
    inset 0 -1px 1px rgba(255, 255, 255, .08),
    0 22px 60px rgba(0, 0, 0, .46) !important;
  backdrop-filter: blur(26px) saturate(1.75) !important;
  -webkit-backdrop-filter: blur(26px) saturate(1.75) !important;
}

.nav-item {
  min-height: 48px !important;
  border-radius: 20px !important;
  color: rgba(232, 238, 249, .72) !important;
}

.nav-item.active {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .3), rgba(255, 255, 255, .08)),
    rgba(79, 143, 255, .8) !important;
  color: white !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .28),
    0 10px 22px rgba(47, 107, 220, .32) !important;
}

.episode-row {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center !important;
}

.episode-row > div {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.episode-row strong {
  display: block;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.episode-row span {
  display: block;
  line-height: 1.2;
}

.pager {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 24px auto 110px;
  width: min(100%, 520px);
}

.media-grid.loading {
  opacity: .68;
}

@media (max-width: 560px) {
  .desktop-header {
    display: grid !important;
    min-height: 82px !important;
    grid-template-columns: 1fr auto !important;
    padding: 14px 20px !important;
  }

  .desktop-header nav,
  .logout-link {
    display: none !important;
  }

  .header-actions {
    display: flex !important;
  }

  .app-shell {
    padding: 100px 16px 170px !important;
  }

  .wordmark {
    max-width: 100%;
    min-width: 0;
    font-size: clamp(22px, 6vw, 28px) !important;
    padding: 0 !important;
  }

  .brand-icon {
    width: 42px !important;
    height: 42px !important;
    flex: 0 0 auto;
  }

  .home-hero {
    margin: 0 !important;
    padding: 24px 18px !important;
  }

  .global-search,
  .search-row {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .global-search button,
  .search-row button {
    width: 100%;
  }

  .live-results {
    position: static !important;
    grid-column: 1 / -1 !important;
    max-height: min(58vh, 420px);
  }

  .live-result {
    grid-template-columns: 48px minmax(0, 1fr) !important;
  }

  .live-result > form,
  .live-result > .mini-button {
    grid-column: 1 / -1 !important;
    width: 100%;
  }

  .live-result .mini-button,
  .live-result button {
    width: 100%;
  }

  .search-card {
    display: grid !important;
    grid-template-columns: 64px minmax(0, 1fr) !important;
    align-items: start !important;
  }

  .search-card form,
  .search-card .mini-button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .torrent-filter,
  .torrent-card {
    grid-template-columns: 1fr;
  }

  .magnet-button {
    width: 100%;
  }

  .poster.small {
    width: 64px !important;
    height: 92px !important;
  }

  .detail-hero {
    grid-template-columns: 96px minmax(0, 1fr) !important;
    gap: 14px !important;
    padding: 14px !important;
  }

  .detail-copy h1 {
    font-size: clamp(28px, 10vw, 40px) !important;
    line-height: 1.05 !important;
  }

  .action-row {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .action-row form,
  .action-row button {
    width: 100% !important;
  }

  .info-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .media-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }

  .hero-copy h1 {
    font-size: 40px !important;
  }

  .hero-copy p:last-child {
    font-size: 18px !important;
  }

  .bottom-nav {
    width: calc(100% - 22px) !important;
  }

  .topbar {
    min-height: auto !important;
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: stretch !important;
    gap: 14px !important;
    padding: 18px !important;
  }

  .topbar form,
  .topbar .mini-button,
  .topbar button {
    width: 100% !important;
  }

  .notification-list,
  .empty-card {
    margin-bottom: 24px;
  }
}

@media (orientation: landscape) and (max-height: 620px) {
  .app-shell {
    padding: 118px 24px 40px !important;
  }

  .desktop-header {
    display: grid !important;
    min-height: 86px !important;
    grid-template-columns: minmax(0, 156px) minmax(0, 1fr) auto !important;
    gap: 10px !important;
    padding: 12px 24px !important;
  }

  .desktop-header nav {
    display: flex !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .desktop-header nav::-webkit-scrollbar {
    display: none;
  }

  .top-nav-link {
    flex: 0 0 auto;
    min-height: 44px;
    max-width: 132px;
    padding: 0 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: clamp(14px, 2vw, 18px);
  }

  .wordmark {
    width: 100%;
    max-width: 156px;
    overflow: hidden;
    font-size: clamp(15px, 2vw, 18px) !important;
    white-space: nowrap;
  }

  .brand-icon {
    width: 32px !important;
    height: 32px !important;
    font-size: 16px !important;
  }

  .notification-bell {
    min-width: 46px !important;
    min-height: 46px !important;
    border-radius: 14px !important;
  }

  .header-actions .logout-link {
    display: none !important;
  }

  .bottom-nav {
    display: none !important;
  }

  .home-hero {
    padding: 26px 34px !important;
  }

  .hero-copy h1 {
    max-width: 760px;
    font-size: clamp(42px, 7vw, 76px) !important;
  }

  .hero-copy p:last-child {
    max-width: 780px !important;
  }

  .episode-row {
    grid-template-columns: 54px minmax(0, 1fr) !important;
    gap: 12px !important;
    padding: 12px 16px !important;
  }

  .episode-toggle {
    width: 46px !important;
    height: 46px !important;
    min-height: 46px !important;
    font-size: 22px !important;
  }

  .episode-row strong {
    font-size: clamp(18px, 3vw, 24px) !important;
  }

  .episode-row span {
    font-size: clamp(14px, 2.4vw, 18px) !important;
  }
}

@media (max-width: 560px) {
  .episode-row {
    grid-template-columns: 68px minmax(0, 1fr) !important;
    gap: 14px !important;
  }

  .episode-toggle {
    width: 54px !important;
    height: 54px !important;
  }

  .episode-row strong {
    font-size: clamp(18px, 5.2vw, 26px);
  }
}

:where(
  button,
  input,
  select,
  textarea,
  .wide-button,
  .mini-button,
  .ghost-link,
  .icon-button,
  .pill,
  .top-nav-link,
  .logout-link,
  .notification-bell,
  .global-search,
  .search-row,
  .torrent-filter,
  .topbar,
  .home-hero,
  .detail-hero,
  .media-card,
  .search-card,
  .torrent-card,
  .season-row,
  .episode-row,
  .notification-card,
  .overview,
  .cast-list,
  .progress-box,
  .empty-card,
  .stat-card,
  .single-action,
  .settings-card,
  .status-alert,
  .bulk-panel,
  .live-results,
  .hero-strip > div,
  .hero-strip > a,
  .info-grid > div
) {
  border-radius: 22px !important;
}

.bottom-nav {
  border-radius: 34px !important;
}

.nav-item,
.nav-item.active {
  border-radius: 24px !important;
}

.poster,
.poster img,
.detail-poster,
.detail-poster img,
.poster-fallback {
  border-radius: 18px !important;
}
