@font-face {
  font-family: system;
  src: local("Segoe UI"), local("Tahoma"), local("Arial");
}

@font-face {
  font-family: "IRANSansFaNum";
  src: url("../fonts/IRANSans(FaNum)_Black.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "IRANSansFaNum";
  src: url("../fonts/IRANSans(FaNum)_Black.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "IRANSansFaNum";
  src: url("../fonts/IRANSans(FaNum)_Black.ttf") format("truetype");
  font-style: normal;
  font-weight: 800;
  font-display: swap;
}

@font-face {
  font-family: "IRANSansFaNum";
  src: url("../fonts/IRANSans(FaNum)_Black.ttf") format("truetype");
  font-style: normal;
  font-weight: 900;
  font-display: swap;
}

:root {
  --bg0: #070a10;
  --bg1: #0a1120;
  --panel: rgba(20, 24, 32, 0.52);
  --panel-strong: rgba(20, 24, 32, 0.72);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.65);
  --faint: rgba(255, 255, 255, 0.45);
  --line: rgba(255, 255, 255, 0.12);
  --shadow: rgba(0, 0, 0, 0.35);
  --accent: #0dcaf0;
  --accent-rgb: 13, 202, 240;
  --on-accent: rgba(0, 0, 0, 0.9);
  --radius: 18px;
  --radius2: 26px;
  --blur: 18px;
  --motion: cubic-bezier(0.2, 0.9, 0.2, 1);
  --motion2: cubic-bezier(0.18, 0.86, 0.2, 1);
}

:root[data-theme="light"] {
  --bg0: #f5f8ff;
  --bg1: #e9f0ff;
  --panel: rgba(255, 255, 255, 0.58);
  --panel-strong: rgba(255, 255, 255, 0.75);
  --text: rgba(10, 14, 18, 0.92);
  --muted: rgba(10, 14, 18, 0.64);
  --faint: rgba(10, 14, 18, 0.45);
  --line: rgba(0, 0, 0, 0.12);
  --shadow: rgba(0, 0, 0, 0.15);
}

:root[data-contrast="high"] {
  --panel: rgba(20, 24, 32, 0.72);
  --panel-strong: rgba(20, 24, 32, 0.86);
  --muted: rgba(255, 255, 255, 0.78);
  --line: rgba(255, 255, 255, 0.22);
}

:root[data-theme="light"][data-contrast="high"] {
  --panel: rgba(255, 255, 255, 0.78);
  --panel-strong: rgba(255, 255, 255, 0.92);
  --muted: rgba(10, 14, 18, 0.74);
  --line: rgba(0, 0, 0, 0.2);
}

:root[data-reduce-motion="true"] * {
  animation-duration: 1ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 1ms !important;
  scroll-behavior: auto !important;
}

* {
  box-sizing: border-box;
}

html,
body {
  overscroll-behavior: none;
  min-height: 100%;
}

html {
  background: radial-gradient(1200px 900px at 30% 10%, rgba(var(--accent-rgb), 0.22), transparent 52%),
    radial-gradient(1100px 900px at 85% 20%, rgba(123, 97, 255, 0.16), transparent 55%),
    radial-gradient(900px 900px at 40% 85%, rgba(255, 61, 180, 0.12), transparent 60%),
    linear-gradient(160deg, var(--bg0), var(--bg1));
}

body,
.panel,
.topbar,
.sheet,
.overlay,
.card,
.saved-card,
.badge,
.toast,
input,
select,
.primary-btn,
.ghost-btn,
.icon-btn,
.chip,
.footer-link,
.details-chip {
  transition: background-color 900ms var(--motion), color 900ms var(--motion), border-color 900ms var(--motion),
    box-shadow 900ms var(--motion);
}

@media (prefers-reduced-motion: reduce) {
  body,
  .panel,
  .topbar,
  .sheet,
  .overlay,
  .card,
  .saved-card,
  .badge,
  .toast,
  input,
  select,
  .primary-btn,
  .ghost-btn,
  .icon-btn,
  .chip,
  .footer-link,
  .details-chip {
    transition-duration: 140ms !important;
  }

  .is-pulse {
    animation-duration: 220ms !important;
  }
}

/* Scrollbar (Chromium/WebKit) */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.12);
}

::-webkit-scrollbar-thumb {
  border-radius: 999px;
  border: 3px solid rgba(0, 0, 0, 0.12);
  background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.55), rgba(var(--accent-rgb), 0.18));
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.7), rgba(var(--accent-rgb), 0.24));
}

::-webkit-scrollbar-corner {
  background: transparent;
}

@supports (scrollbar-color: auto) {
  * {
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--accent-rgb), 0.55) rgba(0, 0, 0, 0.12);
  }
}

body {
  margin: 0;
  font-family: "IRANSansFaNum", system, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  min-height: 100vh;
  background: radial-gradient(1200px 900px at 30% 10%, rgba(var(--accent-rgb), 0.22), transparent 52%),
    radial-gradient(1100px 900px at 85% 20%, rgba(123, 97, 255, 0.16), transparent 55%),
    radial-gradient(900px 900px at 40% 85%, rgba(255, 61, 180, 0.12), transparent 60%),
    linear-gradient(160deg, var(--bg0), var(--bg1));
  overflow-x: hidden;
}

.bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  contain: paint;
  transform: translate3d(0, 0, 0);
  isolation: isolate;
}

.blob {
  position: absolute;
  width: 520px;
  height: 520px;
  border-radius: 999px;
  filter: blur(40px);
  opacity: 0.9;
  mix-blend-mode: screen;
  animation: blobFloat 14s var(--motion) infinite;
}

.blob--a {
  left: -160px;
  top: -160px;
  background: radial-gradient(circle at 30% 30%, rgba(var(--accent-rgb), 0.85), rgba(var(--accent-rgb), 0.05));
}

.blob--b {
  right: -200px;
  top: 80px;
  background: radial-gradient(circle at 30% 30%, rgba(125, 100, 255, 0.7), rgba(125, 100, 255, 0.05));
  animation-delay: -5s;
}

.blob--c {
  left: 10%;
  bottom: -260px;
  background: radial-gradient(circle at 30% 30%, rgba(255, 68, 189, 0.55), rgba(255, 68, 189, 0.05));
  animation-delay: -9s;
}

.noise {
  position: absolute;
  inset: 0;
  opacity: 0.12;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='260' height='260' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

@keyframes blobFloat {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  30% {
    transform: translate3d(40px, 30px, 0) scale(1.06);
  }
  55% {
    transform: translate3d(-20px, 46px, 0) scale(0.98);
  }
  80% {
    transform: translate3d(32px, -12px, 0) scale(1.05);
  }
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
}

.app {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  min-height: 100vh;
  padding: 12px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 14px;
  border-radius: var(--radius2);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent);
  border: 1px solid var(--line);
  box-shadow: 0 18px 50px var(--shadow);
  -webkit-backdrop-filter: blur(var(--blur));
  backdrop-filter: blur(var(--blur));
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  width: 54px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.38), rgba(255, 255, 255, 0.08));
  border: 1px solid rgba(var(--accent-rgb), 0.28);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.5px;
  color: var(--text);
  box-shadow: 0 12px 30px rgba(var(--accent-rgb), 0.15);
}

.brand-title {
  font-weight: 700;
  letter-spacing: 0.2px;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--muted);
}

.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-inline-start: auto;
}

.panel {
  border-radius: var(--radius2);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 18px 50px var(--shadow);
  -webkit-backdrop-filter: blur(var(--blur));
  backdrop-filter: blur(var(--blur));
}

.search-panel {
  margin-top: 12px;
  padding: 14px;
  animation: rise 680ms var(--motion) both;
}

/* Morph-like transitions for search flow */
.app,
.topbar,
.search-panel,
.main-stack,
.results-panel,
.footer {
  transition: transform 560ms var(--motion2), opacity 560ms var(--motion2), filter 560ms var(--motion2);
  transform-origin: 50% 20%;
}

.app[data-search-state="busy"] .search-panel {
  transform: translate3d(0, -10px, 0) scale(0.985);
}

.app[data-search-state="busy"] #searchBtn {
  transform: translate3d(0, -2px, 0) scale(1.08);
}

.app[data-search-state="results"] .search-panel {
  transform: translate3d(0, -12px, 0) scale(0.975);
}

.app[data-search-state="results"] .results-panel {
  transform: translate3d(0, -8px, 0) scale(1);
}

.app[data-search-state="results"] #clearBtn {
  transform: translate3d(0, -1px, 0) scale(1.06);
}

.is-pulse {
  animation: morphPulse 560ms var(--motion2) both;
}

@keyframes morphPulse {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
    filter: brightness(1);
  }
  35% {
    transform: translate3d(0, -2px, 0) scale(1.085);
    filter: brightness(1.12);
  }
  100% {
    transform: translate3d(0, 0, 0) scale(1);
    filter: brightness(1);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translate3d(0, 16px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

.search-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field--grow {
  flex: 1;
  min-width: 260px;
}

.field-label {
  font-size: 12px;
  color: var(--muted);
}

input,
select {
  height: 44px;
  border-radius: 14px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
  font-family: inherit;
  outline: none;
  transition: transform 220ms var(--motion2), border-color 220ms var(--motion2), background 220ms var(--motion2);
}

.dir-rtl {
  direction: rtl;
  text-align: right;
}

.dir-ltr {
  direction: ltr;
  text-align: left;
}

#queryInput[dir="ltr"] {
  text-align: left;
}

#queryInput[dir="rtl"] {
  text-align: right;
}

#tmdbKeyInput {
  direction: ltr;
  text-align: left;
}

:root[data-theme="light"] input,
:root[data-theme="light"] select {
  background: rgba(255, 255, 255, 0.4);
}

input:focus,
select:focus {
  border-color: rgba(var(--accent-rgb), 0.65);
  transform: translate3d(0, -1px, 0);
}

.primary-btn,
.ghost-btn,
.icon-btn,
.chip,
.footer-link {
  height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 0 14px;
  font-family: inherit;
  cursor: pointer;
  transition: transform 220ms var(--motion2), box-shadow 220ms var(--motion2), background 220ms var(--motion2),
    border-color 220ms var(--motion2);
  -webkit-user-select: none;
  user-select: none;
}

.primary-btn {
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.9), rgba(var(--accent-rgb), 0.45));
  border-color: rgba(var(--accent-rgb), 0.55);
  color: var(--on-accent);
  font-weight: 800;
  box-shadow: 0 14px 34px rgba(var(--accent-rgb), 0.22);
}

.primary-btn--danger {
  background: linear-gradient(135deg, rgba(255, 46, 99, 0.92), rgba(255, 46, 99, 0.48));
  border-color: rgba(255, 46, 99, 0.58);
  color: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 34px rgba(255, 46, 99, 0.24);
}

.primary-btn:disabled,
.ghost-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.primary-btn:hover,
.ghost-btn:hover,
.icon-btn:hover,
.chip:hover,
.footer-link:hover {
  transform: translate3d(0, -1px, 0);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.18);
  background: rgba(255, 255, 255, 0.09);
}

.primary-btn:active,
.ghost-btn:active,
.icon-btn:active,
.chip:active,
.footer-link:active {
  transform: translate3d(0, 0, 0);
}

.icon-btn {
  width: 44px;
  padding: 0;
  display: grid;
  place-items: center;
}

.icon-btn--sm {
  width: 40px;
  height: 40px;
  border-radius: 14px;
}

.icon-btn--danger {
  border-color: rgba(255, 46, 99, 0.42);
  background: rgba(255, 46, 99, 0.1);
  color: rgba(255, 255, 255, 0.92);
}

.ghost-btn--sm {
  height: 40px;
  padding: 0 12px;
  border-radius: 14px;
  font-size: 12px;
}

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.saved-section-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.saved-section-actions select {
  height: 40px;
  border-radius: 14px;
}

.chip {
  padding: 0 12px;
}

.hint-row {
  margin-top: 12px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.status-text {
  font-size: 12px;
  color: var(--muted);
}

.quick-settings {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.inline-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
}

.inline-label {
  font-size: 12px;
  color: var(--muted);
}

#accentInput {
  width: 36px;
  height: 26px;
  border: none;
  background: transparent;
  padding: 0;
}

.toggle {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 6px 10px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  font-size: 12px;
  color: var(--muted);
}

.toggle input {
  height: 16px;
  width: 16px;
}

.main-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.player-panel {
  grid-column: 1 / -1;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 13px;
}

.panel-actions {
  display: flex;
  gap: 10px;
}

.results-panel {
  min-height: 440px;
}

.results-grid {
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
}

.card {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent);
  cursor: pointer;
  transition: transform 240ms var(--motion2), border-color 240ms var(--motion2), background 240ms var(--motion2);
}

.card:hover {
  transform: translate3d(0, -2px, 0);
  border-color: rgba(var(--accent-rgb), 0.5);
}

 .card:active {
  transform: translate3d(0, 0, 0) scale(0.98);
 }

.card.is-active {
  border-color: rgba(var(--accent-rgb), 0.7);
  box-shadow: 0 20px 60px rgba(var(--accent-rgb), 0.14);
  animation: cardPop 420ms var(--motion) both;
}

 @keyframes cardPop {
  from {
    transform: translate3d(0, 10px, 0) scale(0.98);
    opacity: 0.5;
  }
  to {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 1;
  }
 }

.poster {
  width: 100%;
  aspect-ratio: 2 / 3;
  background: rgba(0, 0, 0, 0.18);
  display: block;
  object-fit: cover;
}

.card-body {
  padding: 10px;
}

.card-title {
  font-weight: 700;
  font-size: 13px;
  line-height: 1.3;
  margin-bottom: 6px;
}

.marquee {
  overflow: hidden;
  white-space: nowrap;
}

.marquee__inner {
  display: inline-block;
  padding-inline-end: 18px;
  will-change: transform;
  transform: translate3d(0, 0, 0);
}

.marquee.is-active .marquee__inner {
  animation: marqueePingPong var(--marquee-duration, 9s) ease-in-out infinite alternate;
  animation-delay: 700ms;
}

@keyframes marqueePingPong {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(var(--marquee-distance, 0px), 0, 0);
  }
}

:root[data-reduce-motion="true"] .marquee__inner {
  animation: none !important;
  transform: none !important;
}

.card-meta {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
}

.badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.details-panel {
  min-height: 440px;
}

.details-empty {
  padding: 16px;
  color: var(--muted);
}

.details-content {
  padding: 14px;
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
}

.details-poster {
  width: 120px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.details-poster img {
  width: 100%;
  display: block;
}

.details-title {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 6px;
}

.details-sub {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.details-overview {
  font-size: 13px;
  color: var(--text);
  line-height: 1.7;
  opacity: 0.92;
}

.details-controls {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.details-controls select {
  height: 40px;
}

.player-wrap {
  position: relative;
  height: 78vh;
  min-height: 520px;
  border-radius: var(--radius2);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

#playerFrame {
  width: 100%;
  height: 100%;
  border: 0;
  display: none;
  background: #000;
}

.player-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.url-row {
  padding: 12px;
}

#embedUrlInput {
  width: 100%;
  height: 44px;
  background: rgba(0, 0, 0, 0.18);
}

.footer {
  padding: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  color: var(--muted);
}

.footer-links {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.footer-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.footer-link:hover {
  text-decoration: none;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
  padding: 18px;
  overflow: auto;
  z-index: 50;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 520ms var(--motion), visibility 0s linear 520ms;
}

.overlay.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 240ms var(--motion2), visibility 0s;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.sheet {
  width: min(560px, calc(100vw - 36px));
  border-radius: 26px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  box-shadow: 0 18px 60px var(--shadow);
  max-height: calc(100vh - 36px);
  overflow: auto;
  transform: translate3d(0, 36px, 0) scale(0.985);
  opacity: 0;
  transition: transform 520ms var(--motion), opacity 520ms var(--motion);
}

 .overlay.is-open .sheet {
  transform: translate3d(0, 0, 0) scale(1);
  opacity: 1;
 }

@keyframes sheetUp {
  from {
    transform: translate3d(0, 42px, 0);
    opacity: 0;
  }
  to {
    transform: translate3d(0, 0, 0);
    opacity: 1;
  }
}

.sheet-header {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sheet-title {
  font-weight: 800;
}

.sheet-body {
  padding: 14px;
}

.settings-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

:root[data-theme="light"] .settings-section {
  border-top-color: rgba(0, 0, 0, 0.08);
}

.settings-section-title {
  font-weight: 800;
  font-size: 13px;
  margin-bottom: 10px;
  color: var(--muted);
}

.settings-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.settings-grid--accessibility {
  align-items: center;
}

.settings-grid--accessibility .field {
  flex: 1 1 100%;
  min-width: 100%;
}

#uiScaleRange {
  width: 100%;
  height: 44px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

#uiScaleRange:focus {
  outline: none;
}

#uiScaleRange::-webkit-slider-runnable-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

#uiScaleRange::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.92), rgba(var(--accent-rgb), 0.9));
  box-shadow: 0 12px 34px rgba(var(--accent-rgb), 0.28);
  margin-top: -6px;
}

#uiScaleRange::-moz-range-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

#uiScaleRange::-moz-range-progress {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.9), rgba(var(--accent-rgb), 0.3));
}

#uiScaleRange::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.92), rgba(var(--accent-rgb), 0.9));
  box-shadow: 0 12px 34px rgba(var(--accent-rgb), 0.28);
}

:root[data-theme="light"] #uiScaleRange {
  border-color: rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.55);
}

:root[data-theme="light"] #uiScaleRange::-webkit-slider-runnable-track {
  background: rgba(0, 0, 0, 0.12);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

:root[data-theme="light"] #uiScaleRange::-moz-range-track {
  background: rgba(0, 0, 0, 0.12);
  border-color: rgba(0, 0, 0, 0.1);
}

.field-help {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
  line-height: 1.6;
}

.sheet-actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

 .sheet-actions--center {
  justify-content: center;
 }

.sheet-actions-right {
  display: flex;
  gap: 10px;
  align-items: center;
}

 .app.is-home {
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
 }

 .app.is-home .main-stack {
  display: none;
  margin-top: 0;
 }

 .main-stack {
  margin-top: 12px;
 }

 .results-panel.is-revealed {
  animation: rise 640ms var(--motion) both;
 }

 .overlay--details {
  z-index: 60;
 }

 .overlay--api {
  z-index: 55;
 }

 .overlay--saved {
  z-index: 58;
 }

 .overlay--history {
  z-index: 58;
 }

 .overlay--confirm {
  z-index: 65;
 }

 .sheet--api {
  width: min(520px, calc(100vw - 36px));
 }

 .sheet--saved {
  width: min(980px, calc(100vw - 36px));
 }

 .sheet--history {
  width: min(860px, calc(100vw - 36px));
 }

 .sheet--details {
  width: min(1180px, calc(100vw - 36px));
 }

 .sheet--confirm {
  width: min(560px, calc(100vw - 36px));
 }

 .sheet--details .sheet-body {
  padding: 0;
 }

 .sheet-header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.sheet-header-actions--settings {
  flex-direction: row;
  gap: 10px;
}

.confirm-text {
  color: var(--muted);
  line-height: 1.8;
}

 .details-modal {
  display: flex;
  flex-direction: column;
 }

 .saved-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
 }

 .saved-section:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
 }

 :root[data-theme="light"] .saved-section {
  border-top-color: rgba(0, 0, 0, 0.08);
 }

 .saved-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
 }

 .saved-section-title {
  font-weight: 900;
 }

 .saved-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
 }

 .saved-card {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent);
  cursor: pointer;
  transition: transform 240ms var(--motion2), border-color 240ms var(--motion2), background 240ms var(--motion2);
 }

 .saved-card:hover {
  transform: translate3d(0, -2px, 0);
  border-color: rgba(var(--accent-rgb), 0.5);
 }

 .saved-card:active {
  transform: translate3d(0, 0, 0) scale(0.98);
 }

 .saved-poster {
  width: 100%;
  aspect-ratio: 2 / 3;
  background: rgba(0, 0, 0, 0.18);
  display: block;
  object-fit: cover;
 }

 .saved-body {
  padding: 10px;
 }

 .saved-title {
  font-weight: 800;
  font-size: 13px;
  line-height: 1.3;
  margin-bottom: 6px;
 }

 .saved-meta {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
 }

 .saved-remove {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: transform 220ms var(--motion2), background 220ms var(--motion2), border-color 220ms var(--motion2);
 }

 .saved-remove:hover {
  transform: translate3d(0, -1px, 0);
  background: rgba(0, 0, 0, 0.45);
  border-color: rgba(var(--accent-rgb), 0.55);
 }

 .saved-remove:active {
  transform: translate3d(0, 0, 0);
 }

 :root[data-theme="light"] .saved-remove {
  background: rgba(255, 255, 255, 0.55);
  border-color: rgba(0, 0, 0, 0.12);
  color: rgba(10, 14, 18, 0.84);
 }

 .history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
 }

 .history-query {
  width: 100%;
  text-align: start;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  cursor: pointer;
  transition: transform 220ms var(--motion2), box-shadow 220ms var(--motion2), background 220ms var(--motion2),
    border-color 220ms var(--motion2);
 }

 .history-query:hover {
  transform: translate3d(0, -1px, 0);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.18);
  background: rgba(255, 255, 255, 0.09);
 }

 .history-query:active {
  transform: translate3d(0, 0, 0);
 }

 .history-query-main {
  font-weight: 800;
 }

 .history-query-type {
  font-size: 11px;
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.18);
 }

 :root[data-theme="light"] .history-query-type {
  border-color: rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.55);
 }

 .details-modal-hero {
  position: relative;
  min-height: 260px;
  background-size: cover;
  background-position: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
 }

 .details-modal-hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: -1px;
  background: radial-gradient(800px 420px at 20% 10%, rgba(var(--accent-rgb), 0.22), transparent 60%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.82) 75%, rgba(0, 0, 0, 0.92));
 }

 .details-modal-hero-content {
  position: relative;
  z-index: 2;
  padding: 18px;
  display: flex;
  gap: 14px;
  align-items: flex-end;
 }

 .details-modal-poster {
  width: 170px;
  aspect-ratio: 2 / 3;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.22);
  flex: 0 0 auto;
 }

 .details-modal-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
 }

 .details-modal-meta {
  flex: 1;
  min-width: 0;
 }

 .details-modal-title {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.2px;
  line-height: 1.25;
 }

 .details-modal-sub {
  margin-top: 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
 }

 :root[data-theme="light"] .details-modal-sub {
  color: rgba(10, 14, 18, 0.64);
 }

 .details-modal-overview {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.85;
  color: rgba(255, 255, 255, 0.92);
 }

 :root[data-theme="light"] .details-modal-overview {
  color: rgba(10, 14, 18, 0.86);
 }

 .details-modal-controls {
  margin-top: 0;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: end;
}

 .details-modal-controls-row {
  margin-top: 12px;
  display: flex;
  gap: 12px;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
 }

 .details-modal-actions {
  display: flex;
  gap: 10px;
  align-items: center;
 }

 .details-modal-chips {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
 }

 .details-chip {
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font-size: 12px;
  line-height: 1;
  cursor: default;
  -webkit-user-select: none;
  user-select: none;
 }

 :root[data-theme="light"] .details-chip {
  color: rgba(10, 14, 18, 0.84);
  background: rgba(255, 255, 255, 0.55);
  border-color: rgba(0, 0, 0, 0.12);
 }

 .details-chip strong {
  font-weight: 900;
 }

 .details-modal-controls select {
  height: 40px;
 }

 .details-modal-player {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
 }

 .details-modal-player-actions {
  display: flex;
  justify-content: flex-end;
 }

 .player-wrap--modal {
  height: 62vh;
  min-height: 420px;
 }

 #detailsPlayerFrame {
  width: 100%;
  height: 100%;
  border: 0;
  display: none;
  background: #000;
 }

 #detailsEmbedUrlInput {
  width: 100%;
  height: 44px;
  background: rgba(0, 0, 0, 0.18);
  direction: ltr;
  text-align: left;
  cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
 }

 .toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translate3d(-50%, 14px, 0);
  opacity: 0;
  pointer-events: none;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.32);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: var(--text);
  font-size: 12px;
  z-index: 80;
  transition: transform 320ms var(--motion), opacity 320ms var(--motion);
 }

 .toast.is-open {
  opacity: 1;
  transform: translate3d(-50%, 0, 0);
 }

.noscript {
  position: fixed;
  bottom: 10px;
  left: 10px;
  right: 10px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  color: #fff;
  z-index: 100;
}

@media (max-width: 980px) {
  .main-grid {
    grid-template-columns: 1fr;
  }

  .results-grid {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  }
}

@media (max-width: 720px) {
  .results-grid {
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  }

  .field--grow {
    min-width: 100%;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .footer {
    justify-content: center;
  }

  .details-modal-hero-content {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .details-modal-poster {
    width: 150px;
  }

  .details-modal-player {
    padding: 12px;
  }

  .details-modal-controls-row {
    justify-content: center;
  }

  .player-wrap--modal {
    height: 54vh;
    min-height: 320px;
  }

  .player-wrap {
    height: 66vh;
    min-height: 420px;
  }
}
