:root {
  color-scheme: dark;
  --bg: #101112;
  --panel: #181a1d;
  --panel-2: #202326;
  --text: #f7f2e8;
  --muted: #b8b0a4;
  --line: #34383d;
  --brand: #ffb02e;
  --brand-2: #2fc4a7;
  --danger: #ff6b5f;
  --shadow: 0 16px 44px rgba(0, 0, 0, 0.32);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(255, 176, 46, 0.06), transparent 320px),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

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

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(148px, auto) minmax(180px, 560px) auto;
  gap: 16px;
  align-items: center;
  padding: 16px clamp(16px, 4vw, 42px);
  background: rgba(16, 17, 18, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  color: var(--brand);
  font-size: 23px;
  font-weight: 850;
  letter-spacing: 0;
}

.searchbar {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  min-width: 0;
  border: 1px solid var(--line);
  background: #0d0e10;
  border-radius: var(--radius);
  overflow: hidden;
}

.searchbar input {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 14px;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
}

.searchbar button,
.button,
.server-button,
.pager a {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: #101112;
  background: var(--brand);
  font-weight: 750;
  cursor: pointer;
}

.searchbar button {
  height: 42px;
  border-radius: 0;
}

.api-pill {
  justify-self: end;
  max-width: 280px;
  min-height: 34px;
  padding: 8px 11px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--panel);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.api-pill.is-ok {
  color: #b9ffef;
  border-color: rgba(47, 196, 167, 0.45);
}

.api-pill.is-warn {
  color: #ffd5d0;
  border-color: rgba(255, 107, 95, 0.55);
}

.nav-tabs {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px clamp(16px, 4vw, 42px);
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  background: #141517;
}

.nav-tabs a {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-weight: 750;
}

.nav-tabs a.is-active {
  color: #101112;
  border-color: var(--brand);
  background: var(--brand);
}

.content {
  flex: 1;
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: 24px clamp(16px, 4vw, 42px) 60px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 30px;
}

.feature {
  position: relative;
  min-height: 340px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.feature img {
  width: 100%;
  height: 100%;
  min-height: 340px;
  object-fit: cover;
  opacity: 0.58;
}

.feature::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(90deg, rgba(16, 17, 18, 0.96), rgba(16, 17, 18, 0.3));
}

.feature-body {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 1;
  display: grid;
  gap: 12px;
  width: min(640px, 100%);
  padding: 26px;
}

.eyebrow,
.meta-row,
.small-text {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.feature h1,
.page-title {
  margin: 0;
  font-size: clamp(28px, 4.2vw, 54px);
  line-height: 1.02;
  letter-spacing: 0;
}

.quick-panel {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.quick-row {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 76px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: #111214;
}

.quick-row:hover,
.card:hover {
  border-color: rgba(255, 176, 46, 0.5);
}

.quick-row img {
  width: 58px;
  aspect-ratio: 2 / 3;
  border-radius: 6px;
  object-fit: cover;
  background: var(--panel-2);
}

.section {
  margin-top: 30px;
}

.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: clamp(72px, 10vw, 128px);
  margin: 0 0 18px;
  padding: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #141517;
}

.ad-slot a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: inherit;
}

.ad-slot img,
.ad-slot iframe {
  display: block;
  max-width: 100%;
  border: 0;
}

.ad-slot img {
  width: 100%;
  height: auto;
  max-height: 180px;
  object-fit: contain;
}

.ad-slot-adsense {
  min-height: clamp(90px, 12vw, 150px);
  background: #111214;
}

.ad-slot-adsense .adsbygoogle {
  display: block !important;
  width: 100%;
  min-width: 250px;
  min-height: 90px;
}

.ad-slot.is-empty {
  border-style: dashed;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.section .ad-slot {
  margin-bottom: 14px;
}

.section-head {
  display: flex;
  gap: 14px;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section h2,
.detail-title,
.watch-title {
  margin: 0;
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1.15;
  letter-spacing: 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
  gap: 16px;
}

.card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  transition:
    border-color 160ms ease,
    transform 160ms ease;
}

.card:hover {
  transform: translateY(-2px);
}

.poster {
  position: relative;
  display: block;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: var(--panel-2);
}

.poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  max-width: 100%;
  padding: 3px 8px;
  border-radius: 999px;
  color: #101112;
  background: var(--brand-2);
  font-size: 12px;
  font-weight: 850;
}

.poster .badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
}

.card-body {
  display: grid;
  gap: 8px;
  padding: 11px;
}

.card-title,
.quick-title,
.episode-title {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.35;
  font-weight: 800;
}

.card-title {
  min-height: 42px;
}

.episode-title {
  font-size: clamp(16px, 2.2vw, 22px);
  line-height: 1;
}

.meta-row {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  align-items: center;
}

.loading,
.empty,
.error-box {
  display: grid;
  place-items: center;
  min-height: 260px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--panel);
  text-align: center;
}

.error-box {
  color: #ffd5d0;
  border-color: rgba(255, 107, 95, 0.55);
}

.pager {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 24px;
}

.pager a {
  display: inline-flex;
  align-items: center;
}

.pager a.is-disabled {
  pointer-events: none;
  opacity: 0.45;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(180px, 270px) minmax(0, 1fr);
  gap: 26px;
  align-items: start;
}

.detail-poster {
  width: 100%;
  aspect-ratio: 2 / 3;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  object-fit: cover;
  background: var(--panel-2);
}

.detail-body {
  display: grid;
  gap: 16px;
}

.meta-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.meta-item {
  min-height: 66px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.meta-label {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.synopsis {
  max-width: 920px;
  color: #ded7ce;
  line-height: 1.68;
}

.chips,
.alphabet {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip,
.alphabet a {
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--panel);
  font-size: 13px;
  font-weight: 750;
}

.alphabet a.is-active {
  color: #101112;
  border-color: var(--brand);
  background: var(--brand);
}

.episode-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(62px, 1fr));
  gap: 10px;
}

.episode-row {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  min-height: 54px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  text-align: center;
}

.episode-row:hover {
  border-color: rgba(47, 196, 167, 0.55);
  background: #202326;
}

.episode-row.is-active {
  color: #101112;
  border-color: var(--brand);
  background: var(--brand);
  box-shadow: 0 0 0 2px rgba(255, 176, 46, 0.18);
}

.episode-row.is-active .episode-title {
  color: #101112;
}

.watch-layout {
  display: grid;
  gap: 18px;
}

.player-shell {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #050506;
  box-shadow: var(--shadow);
}

.player-area {
  position: relative;
  z-index: 1;
}

.player-shell iframe,
.player-empty {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
}

.player-empty {
  display: grid;
  place-items: center;
  padding: 16px;
  color: var(--muted);
  text-align: center;
}

.player-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--panel);
  font-size: 13px;
  font-weight: 850;
}

.player-nav:hover {
  color: #101112;
  border-color: var(--brand);
  background: var(--brand);
}

.player-bottom-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: center;
  min-height: 62px;
  padding: 10px;
  border-top: 1px solid var(--line);
  background: #0d0e10;
}

.player-bottom-nav > div:last-child {
  text-align: right;
}

.server-list,
.watch-actions,
.download-grid,
.schedule-list {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.server-list,
.watch-actions,
.download-panel {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(24, 26, 29, 0.72);
}

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

.download-grid .button {
  min-height: 36px;
  padding-inline: 12px;
}

.server-button {
  color: var(--text);
  border-color: var(--line);
  background: var(--panel);
}

.server-button.is-active {
  color: #101112;
  border-color: var(--brand-2);
  background: var(--brand-2);
}

.button.secondary {
  color: var(--text);
  border-color: var(--line);
  background: var(--panel);
}

.schedule-day {
  margin-top: 24px;
}

.schedule-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.schedule-item {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  min-height: 98px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.schedule-item img {
  width: 64px;
  aspect-ratio: 2 / 3;
  border-radius: 6px;
  object-fit: cover;
  background: var(--panel-2);
}

.static-page {
  display: grid;
  gap: 16px;
  max-width: 860px;
  padding: clamp(18px, 4vw, 34px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.static-page h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.08;
  letter-spacing: 0;
}

.static-page p {
  margin: 0;
  color: #ded7ce;
  font-size: 16px;
  line-height: 1.75;
}

.site-footer {
  display: grid;
  gap: 12px;
  justify-items: center;
  padding: 22px clamp(16px, 4vw, 42px) 26px;
  border-top: 1px solid var(--line);
  background: #0d0e10;
}

.footer-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-links a {
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.footer-links a:hover {
  color: #101112;
  border-color: var(--brand);
  background: var(--brand);
}

.footer-copy {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  text-align: center;
}

@media (max-width: 820px) {
  .topbar {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .api-pill {
    justify-self: stretch;
  }

  .hero-grid,
  .detail-layout {
    grid-template-columns: 1fr;
  }

  .feature,
  .feature img {
    min-height: 300px;
  }

  .detail-poster {
    width: min(260px, 100%);
  }
}

@media (max-width: 520px) {
  .content {
    padding-top: 18px;
  }

  .ad-slot {
    min-height: 66px;
    padding: 6px;
  }

  .ad-slot img {
    max-height: 110px;
  }

  .ad-slot-adsense {
    min-height: 90px;
  }

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

  .feature-body {
    padding: 18px;
  }

  .card-title {
    min-height: 58px;
    font-size: 14px;
  }

  .episode-list {
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
  }

  .player-bottom-nav {
    min-height: 56px;
    padding: 8px;
  }
}
