/* ---------- Series broadcast schedule (home page) ---------- */

.seriesSchedule {
  margin-top: 20px;
}

.seriesSchedule .scheduleBox {
  padding: 18px;
  overflow: hidden;
}

.seriesSchedule .icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex-shrink: 0;
}

/* Head */
.seriesSchedule .scheduleHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.seriesSchedule .scheduleHead h2 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 7px 12px;
  border: 2px solid var(--main-rgb);
  border-radius: 8px;
  color: var(--main-rgb);
  font-size: 16px;
  font-weight: bold;
}

.seriesSchedule .scheduleNav {
  display: flex;
  gap: 6px;
}

.seriesSchedule .scheduleArrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 10px;
  background: var(--background-end-rgb);
  color: var(--text-rbg);
  cursor: pointer;
  transition: background .2s, color .2s, opacity .2s;
}

.seriesSchedule .scheduleArrow:hover:not(:disabled) {
  background: var(--main-rgb);
  color: #1f1f1f;
}

.seriesSchedule .scheduleArrow:disabled {
  opacity: .35;
  cursor: default;
}

.seriesSchedule.noScroll .scheduleNav {
  visibility: hidden;
}

/* Day tabs */
.seriesSchedule .scheduleTabs {
  position: relative;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.seriesSchedule .scheduleTab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 6px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--background-end-rgb);
  color: var(--text-rbg);
  font-family: inherit;
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s, transform .2s;
}

.seriesSchedule .scheduleTab:hover {
  border-color: var(--main-rgb);
}

.seriesSchedule .scheduleTab:focus-visible {
  outline: 2px solid var(--main-primary);
  outline-offset: 2px;
}

.seriesSchedule .scheduleTab .dayName {
  font-size: 14px;
  font-weight: bold;
}

.seriesSchedule .scheduleTab .dayDate {
  min-height: 18px;
  font-size: 12px;
  opacity: .75;
}

.seriesSchedule .scheduleTab .todayBadge {
  display: none;
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
  padding: 1px 8px;
  border-radius: 20px;
  background: var(--main-primary);
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  white-space: nowrap;
}

.seriesSchedule .scheduleTab.isToday .todayBadge {
  display: block;
}

.seriesSchedule .scheduleTab.active {
  background: var(--main-rgb);
  border-color: var(--main-rgb);
  color: #1f1f1f;
  box-shadow: 0 4px 14px rgba(255, 152, 0, .35);
}

.seriesSchedule .scheduleTab.active .dayDate {
  opacity: .85;
}

/* Cards row */
.seriesSchedule .scheduleRow {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - 5 * 14px) / 6);
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  overscroll-behavior-x: contain;
  padding-bottom: 6px;
  scrollbar-width: none;
}

.seriesSchedule .scheduleRow::-webkit-scrollbar {
  display: none;
}

.seriesSchedule .schedulePanel {
  animation: scheduleFade .3s ease;
}

@keyframes scheduleFade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.seriesSchedule .scheduleCard {
  scroll-snap-align: start;
  min-width: 0;
}

.seriesSchedule .scheduleCard a {
  display: block;
  color: inherit;
  text-decoration: none;
}

.seriesSchedule .scheduleCard figure {
  position: relative;
  margin: 0;
  aspect-ratio: 2 / 3;
  border-radius: 14px;
  overflow: hidden;
  background: var(--background-end-rgb);
  box-shadow: 0 4px 12px var(--main-rgb-shadow);
}

.seriesSchedule .scheduleCard img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .4s ease;
}

.seriesSchedule .scheduleCard figure::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, .85) 0%, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, 0) 75%, rgba(0, 0, 0, .45) 100%);
  pointer-events: none;
}

.seriesSchedule .scheduleCard a:hover img,
.seriesSchedule .scheduleCard a:focus-visible img {
  transform: scale(1.06);
}

.seriesSchedule .scheduleCard a:focus-visible figure {
  outline: 2px solid var(--main-primary);
  outline-offset: 2px;
}

.seriesSchedule .cardBadges {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.seriesSchedule .badge,
.seriesSchedule .scoreBadge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.4;
  backdrop-filter: blur(4px);
}

.seriesSchedule .badge .icon,
.seriesSchedule .scoreBadge .icon {
  width: 12px;
  height: 12px;
}

.seriesSchedule .timeBadge {
  background: rgba(0, 0, 0, .65);
  color: #fff;
  direction: ltr;
}

.seriesSchedule .dubBadge {
  background: var(--main-primary);
  color: #fff;
}

.seriesSchedule .scoreBadge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1;
  background: rgba(0, 0, 0, .65);
  color: var(--main-lighter);
  font-weight: bold;
}

.seriesSchedule .scheduleCard figcaption {
  position: absolute;
  right: 8px;
  left: 8px;
  bottom: 8px;
  z-index: 1;
  color: #fff;
  font-size: 12px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.seriesSchedule .cardInfo {
  padding: 8px 2px 0;
}

.seriesSchedule .cardInfo h3 {
  margin: 0;
  font-size: 14px;
  font-weight: bold;
  color: var(--text-rbg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color .2s;
}

.seriesSchedule .scheduleCard a:hover h3 {
  color: var(--main-rgb);
}

.seriesSchedule .cardInfo p {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--text-end-rgb);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seriesSchedule .cardInfo .enTitle {
  text-align: right;
}

.seriesSchedule .cardInfo .network {
  display: flex;
  align-items: center;
  gap: 4px;
}

.seriesSchedule .cardInfo .network .icon {
  width: 13px;
  height: 13px;
}

/* Empty day */
.seriesSchedule .scheduleEmpty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px 10px;
  border: 2px dashed var(--background-end-rgb);
  border-radius: 14px;
  color: var(--text-end-rgb);
  text-align: center;
}

.seriesSchedule .scheduleEmpty .icon {
  width: 36px;
  height: 36px;
  opacity: .6;
}

.seriesSchedule .scheduleEmpty p {
  margin: 0;
}

/* ---------- Responsive ---------- */

@media only screen and (max-width: 1020px) {
  .seriesSchedule .scheduleRow {
    grid-auto-columns: calc((100% - 4 * 14px) / 5);
  }
}

@media only screen and (max-width: 800px) {
  .seriesSchedule .scheduleRow {
    grid-auto-columns: calc((100% - 3 * 12px) / 4);
    gap: 12px;
  }

  /* Day tabs become a swipeable strip */
  .seriesSchedule .scheduleTabs {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    padding-top: 8px;
    margin-top: -8px;
  }

  .seriesSchedule .scheduleTabs::-webkit-scrollbar {
    display: none;
  }

  .seriesSchedule .scheduleTab {
    flex: 0 0 auto;
    min-width: 84px;
    scroll-snap-align: center;
  }
}

@media only screen and (max-width: 600px) {
  .seriesSchedule .scheduleBox {
    padding: 14px 12px;
  }

  .seriesSchedule .scheduleHead h2 {
    font-size: 14px;
    padding: 6px 10px;
  }

  /* Touch: swipe instead of arrows */
  .seriesSchedule .scheduleNav {
    display: none;
  }

  /* 2.5 cards so the next one peeks in and hints at swiping */
  .seriesSchedule .scheduleRow {
    grid-auto-columns: calc((100% - 2 * 10px) / 2.5);
    gap: 10px;
  }

  .seriesSchedule .scheduleTab {
    min-width: 74px;
    padding: 8px 4px;
  }

  .seriesSchedule .cardInfo h3 {
    font-size: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .seriesSchedule .schedulePanel,
  .seriesSchedule .scheduleCard img,
  .seriesSchedule .scheduleRow {
    animation: none;
    transition: none;
    scroll-behavior: auto;
  }
}
