:root {
  color-scheme: dark;
  --bg: #090b16;
  --surface: #111526;
  --surface-2: #171c30;
  --surface-3: #202640;
  --border: rgba(255,255,255,.075);
  --text: #f4f5fb;
  --muted: #929bb5;
  --purple: #9575ff;
  --blue: #5c9dff;
  --green: #55d6a0;
  --danger: #ff7185;
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Vazirmatn", Tahoma, sans-serif;
  overflow-x: hidden;
}

button, input {
  font: inherit;
}

button, a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

.ambient {
  position: fixed;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: .12;
  pointer-events: none;
  z-index: -1;
}

.ambient-one {
  top: -180px;
  right: -100px;
  background: #7547ff;
}

.ambient-two {
  top: 550px;
  left: -250px;
  background: #287dff;
}

.topbar {
  height: 76px;
  padding: 0 max(22px, calc((100% - 1160px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: rgba(9,11,22,.78);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-mark {
  width: 39px;
  height: 39px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 23px;
  color: white;
  background: linear-gradient(135deg, #9b75ff, #527eff);
  box-shadow: 0 5px 25px #7959ff40;
}

.brand-name {
  font-size: 17px;
  font-weight: 800;
  direction: ltr;
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.brand-name span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e3b75b;
  box-shadow: 0 0 12px currentColor;
}

.status-dot.online {
  background: var(--green);
}

.status-dot.offline {
  background: var(--danger);
}

#app {
  width: min(1160px, calc(100% - 40px));
  min-height: calc(100vh - 140px);
  margin: 0 auto;
  padding: 38px 0 70px;
}

.hero {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(160,140,255,.15);
  border-radius: 28px;
  padding: 48px;
  background:
    radial-gradient(ellipse at 10% 100%, #344e9a33, transparent 45%),
    radial-gradient(ellipse at 90% 0%, #8d5aff30, transparent 48%),
    linear-gradient(125deg, #17182e, #11182a 65%, #12152a);
}

.hero::after {
  content: "F";
  position: absolute;
  left: 55px;
  top: -95px;
  font-size: 360px;
  line-height: 1;
  font-weight: 800;
  color: rgba(255,255,255,.025);
  pointer-events: none;
}

.eyebrow {
  color: #b8a6ff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .4px;
  margin-bottom: 15px;
}

.hero h1 {
  max-width: 650px;
  margin: 0;
  font-size: clamp(27px, 4vw, 43px);
  line-height: 1.55;
  font-weight: 800;
}

.hero h1 span {
  color: #a88aff;
}

.hero p {
  color: var(--muted);
  max-width: 530px;
  font-size: 14px;
  line-height: 2;
  margin: 13px 0 27px;
}

.search-box {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 610px;
  height: 58px;
  padding: 0 18px;
  border: 1px solid #ffffff18;
  border-radius: 15px;
  background: #090c19a8;
  transition: border-color .2s, box-shadow .2s;
}

.search-box:focus-within {
  border-color: #9476ff88;
  box-shadow: 0 0 0 4px #9476ff12;
}

.search-icon {
  color: #a995ff;
  font-size: 20px;
}

.search-box input {
  flex: 1;
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: white;
  background: transparent;
  font-size: 13px;
}

.search-box input::placeholder {
  color: #77809a;
}

.section {
  margin-top: 42px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 19px;
}

.section-heading h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
}

.section-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.type-switch {
  display: flex;
  gap: 5px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: #111526;
}

.type-button {
  padding: 9px 17px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  font-size: 12px;
  transition: .2s;
}

.type-button.active {
  color: white;
  background: linear-gradient(110deg, #7958db, #536fe0);
  box-shadow: 0 4px 16px #7357df35;
}

.year-list {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.year-button {
  min-width: 76px;
  padding: 11px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: #c5cbe0;
  cursor: pointer;
  transition: .2s;
  font-size: 13px;
}

.year-button:hover,
.year-button.active {
  border-color: #8d70ff88;
  background: #7958db22;
  color: white;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.catalog-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 17px;
  background: linear-gradient(145deg, #171c30, #111526);
  cursor: pointer;
  transition: transform .2s, border-color .2s, box-shadow .2s;
}

.catalog-card:hover {
  transform: translateY(-4px);
  border-color: #9476ff66;
  box-shadow: 0 12px 35px #0003;
}

.poster {
  height: 190px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 20% 20%, #9575ff55, transparent 48%),
    radial-gradient(circle at 85% 90%, #3986e855, transparent 45%),
    linear-gradient(145deg, #252747, #13182d);
}

.poster::before,
.detail-poster::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, #090b16a8, transparent 75%);
}

.poster-letter {
  font-size: 65px;
  font-weight: 800;
  color: #ffffff35;
  direction: ltr;
}

.poster-type {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 5px 9px;
  border-radius: 7px;
  background: #090b16a8;
  color: #d7d1ff;
  font-size: 10px;
}

.card-info {
  padding: 14px;
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-subtitle {
  color: var(--muted);
  font-size: 11px;
  margin-top: 7px;
  direction: ltr;
  text-align: right;
}

.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
}

.card-tag {
  color: #b6a3ff;
  background: #8c6aff19;
  border: 1px solid #8c6aff25;
  border-radius: 7px;
  padding: 4px 8px;
  font-size: 10px;
}

.card-arrow {
  color: #a68cff;
  font-size: 18px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 12px;
}

.breadcrumb button {
  color: #b7a3ff;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
}

.detail-header {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 30px;
  align-items: center;
  padding: 25px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: linear-gradient(120deg, #171c31, #111526);
}

.detail-poster {
  height: 280px;
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background:
    radial-gradient(circle at 20% 20%, #9575ff70, transparent 48%),
    radial-gradient(circle at 85% 90%, #3986e855, transparent 45%),
    linear-gradient(145deg, #252747, #13182d);
}

.detail-poster span {
  font-size: 85px;
  font-weight: 800;
  color: #ffffff40;
  direction: ltr;
}

.detail-content h1 {
  margin: 0 0 7px;
  font-size: clamp(23px, 3vw, 34px);
}

.original-title {
  color: var(--muted);
  direction: ltr;
  text-align: right;
  font-size: 13px;
  margin-bottom: 18px;
}

.detail-description {
  color: #aeb6ce;
  font-size: 13px;
  line-height: 2.1;
  margin: 15px 0;
}

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

.meta-chip {
  padding: 7px 10px;
  border: 1px solid var(--border);
  background: #ffffff06;
  color: #cbd1e5;
  border-radius: 8px;
  font-size: 10px;
}

.detail-section {
  margin-top: 30px;
}

.detail-section h2 {
  font-size: 17px;
  margin: 0 0 15px;
}

.download-list {
  display: grid;
  gap: 10px;
}

.download-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 15px 17px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.download-main {
  min-width: 0;
}

.download-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 9px;
}

.download-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.download-meta span {
  padding: 4px 7px;
  background: #ffffff08;
  border-radius: 6px;
  color: var(--muted);
  font-size: 10px;
}

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

.download-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 15px;
  border: 0;
  border-radius: 9px;
  background: linear-gradient(110deg, #8b65ee, #557ee9);
  color: white;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  transition: .2s;
}

.download-button:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
}

.secondary-button {
  color: #c6b9ff;
  border: 1px solid #8c6aff38;
  background: #8c6aff14;
}

.season-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.season-button {
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 14px;
  color: var(--muted);
  background: var(--surface);
  cursor: pointer;
  font-size: 11px;
}

.season-button.active {
  color: white;
  border-color: #9476ff88;
  background: #7958db2b;
}

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

.episode-card {
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.episode-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 13px;
}

.episode-heading strong {
  font-size: 13px;
}

.episode-heading span {
  color: var(--muted);
  font-size: 10px;
}

.episode-card .download-item {
  padding: 11px;
  margin-top: 8px;
  background: #0d1120;
}

.episode-card .download-title {
  font-size: 11px;
}

.subtitle-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
  font-size: 12px;
}

.empty-state,
.error-state {
  text-align: center;
  padding: 45px 20px;
  border: 1px dashed #ffffff20;
  border-radius: 17px;
  color: var(--muted);
  background: #ffffff04;
  font-size: 13px;
  line-height: 2;
}

.error-state {
  color: #ff9eaa;
}

.retry-button {
  margin-top: 15px;
  padding: 9px 15px;
  border: 1px solid #ffffff25;
  border-radius: 9px;
  color: white;
  background: #ffffff0b;
  cursor: pointer;
}

.loading-screen {
  min-height: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 15px;
  color: var(--muted);
  font-size: 12px;
}

.loader {
  width: 32px;
  height: 32px;
  border: 3px solid #ffffff18;
  border-top-color: #a78bff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translate(-50%, 20px);
  padding: 11px 18px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #202640;
  color: white;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: .25s;
  z-index: 50;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.footer {
  min-height: 65px;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--border);
  color: #68718a;
  font-size: 10px;
  direction: ltr;
}

@media (max-width: 900px) {
  .catalog-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 650px) {
  .topbar {
    height: 65px;
    padding: 0 17px;
  }

  #app {
    width: calc(100% - 28px);
    padding-top: 22px;
  }

  .hero {
    padding: 29px 22px;
    border-radius: 21px;
  }

  .hero::after {
    left: -15px;
    top: -35px;
    font-size: 230px;
  }

  .hero p {
    font-size: 12px;
  }

  .search-box {
    height: 53px;
  }

  .section {
    margin-top: 31px;
  }

  .section-heading h2 {
    font-size: 16px;
  }

  .catalog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 11px;
  }

  .poster {
    height: 155px;
  }

  .card-info {
    padding: 11px;
  }

  .card-title {
    font-size: 12px;
  }

  .detail-header {
    grid-template-columns: 105px 1fr;
    gap: 16px;
    padding: 15px;
  }

  .detail-poster {
    height: 155px;
  }

  .detail-poster span {
    font-size: 48px;
  }

  .detail-content h1 {
    font-size: 19px;
  }

  .original-title {
    font-size: 10px;
    margin-bottom: 10px;
  }

  .detail-description {
    font-size: 11px;
  }

  .download-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .download-actions {
    width: 100%;
  }

  .download-actions a,
  .download-actions button {
    flex: 1;
  }

  .episode-card .download-item {
    align-items: flex-start;
  }

  .footer {
    font-size: 9px;
  }
}

@media (max-width: 370px) {
  .catalog-grid {
    grid-template-columns: 1fr 1fr;
  }

  .poster {
    height: 130px;
  }

  .header-status {
    font-size: 9px;
  }

  .brand-name {
    font-size: 15px;
  }
}
