:root {
  --color-page: #080808;
  --color-dark: #0a0a0a;
  --color-panel: #121212;
  --color-panel-2: #1a1a1a;
  --color-border: #2a2a2a;
  --color-text: #ffffff;
  --color-muted: #9a9a9a;
  --color-primary: #ffd21c;
  --color-primary-end: #f5a623;
  --hg-btn-gradient: linear-gradient(90deg, #ffd21c 0%, #f5a623 100%);
  --hg-radius: 12px;
  --hg-page-gutter: clamp(16px, 4vw, 48px);
  --header-h: 64px;
  font-family:
    'PingFang SC',
    'Hiragino Sans GB',
    'Microsoft YaHei',
    system-ui,
    -apple-system,
    sans-serif;
  color: var(--color-text);
  background: var(--color-page);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--color-page);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.hg-layout {
  min-height: 100vh;
  background: var(--color-page);
}

/* —— Header —— */
.hg-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: rgba(8, 8, 8, 0.92);
  border-bottom: 1px solid #151515;
  backdrop-filter: blur(12px);
}

.hg-header__inner {
  width: min(1280px, calc(100% - 2 * var(--hg-page-gutter)));
  height: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
}

.hg-header__logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.hg-header__logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--hg-btn-gradient);
  color: #111;
  font-weight: 800;
  font-size: 14px;
}

.hg-header__logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.hg-header__logo-text strong {
  font-size: 16px;
}

.hg-header__logo-text small {
  color: var(--color-muted);
  font-size: 11px;
}

.hg-header__menu {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
}

.hg-nav-item {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  color: #e8e8e8;
  white-space: nowrap;
  font-size: 14px;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.hg-nav-item:hover {
  color: #111;
  background: rgba(255, 210, 28, 0.85);
}

.hg-nav-item.is-active {
  color: #111;
  background: var(--hg-btn-gradient);
  font-weight: 700;
}

.hg-header__search {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 180px;
  width: min(280px, 32vw);
  height: 36px;
  padding: 0 4px 0 14px;
  border-radius: 999px;
  background: #1c1c1c;
  border: 1px solid #2c2c2c;
  flex-shrink: 0;
}

.hg-header__search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #fff;
  font-size: 13px;
}

.hg-header__search input::placeholder {
  color: #777;
}

.hg-header__search button {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #bbb;
  cursor: pointer;
}

.hg-header__search button:hover {
  color: var(--color-primary);
}

/* —— Main —— */
.hg-main {
  width: min(1680px, calc(100% - 2 * var(--hg-page-gutter)));
  margin: 0 auto;
  padding: 20px 0 64px;
}

.view[hidden] {
  display: none !important;
}

.hg-muted {
  color: var(--color-muted);
  font-size: 13px;
  line-height: 1.6;
}

/* —— Buttons —— */
.hg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  transition:
    transform 0.12s ease,
    filter 0.12s ease,
    background 0.12s ease;
}

.hg-btn:hover {
  filter: brightness(1.05);
}

.hg-btn:active {
  transform: translateY(1px);
}

.hg-btn--primary {
  color: #111;
  background: var(--hg-btn-gradient);
}

.hg-btn--ghost {
  color: #eee;
  background: #222;
  border: 1px solid #333;
  font-weight: 600;
}

.hg-btn--block {
  width: 100%;
  margin-top: 14px;
}

.mode-switch {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}

.mode-button {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid #333;
  background: #1a1a1a;
  color: #ccc;
  cursor: pointer;
  font-size: 12px;
}

.mode-button.active,
.mode-button:hover {
  color: #111;
  border-color: transparent;
  background: var(--hg-btn-gradient);
  font-weight: 700;
}

/* —— Hero —— */
.hg-hero {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  min-height: clamp(280px, 42vw, 420px);
  background: #141414;
  margin-bottom: 16px;
}

.hg-hero__bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      circle at 70% 40%,
      rgba(255, 210, 28, 0.12),
      transparent 40%
    ),
    linear-gradient(120deg, #1a1a1a, #0d0d0d);
  background-size: cover;
  background-position: center;
  transform: scale(1.04);
}

.hg-hero__mask {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.88) 0%,
    rgba(0, 0, 0, 0.45) 48%,
    rgba(0, 0, 0, 0.2) 100%
  );
}

.hg-hero__content {
  position: relative;
  z-index: 1;
  max-width: 560px;
  padding: clamp(24px, 5vw, 48px);
}

.hg-hero__eyebrow {
  margin: 0 0 10px;
  color: #ddd;
  font-size: 13px;
}

.hg-hero__title {
  margin: 0 0 12px;
  font-size: clamp(28px, 5vw, 44px);
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.hg-hero__desc {
  margin: 0 0 14px;
  color: #cfcfcf;
  font-size: 14px;
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hg-hero__badge {
  display: inline-flex;
  margin: 0 0 16px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #eee;
  font-size: 12px;
}

.hg-hero__thumbs {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 1;
  display: flex;
  gap: 8px;
  max-width: min(420px, 48%);
  overflow-x: auto;
  padding-bottom: 2px;
}

.hg-hero__thumb {
  flex: 0 0 auto;
  width: 56px;
  height: 78px;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  padding: 0;
  background: #222;
  cursor: pointer;
}

.hg-hero__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hg-hero__thumb.is-active {
  border-color: var(--color-primary);
}

.hg-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  padding: 10px 14px;
  border-radius: 10px;
  background: linear-gradient(90deg, #c47a12, #e0a020);
  color: #fff;
  font-size: 13px;
}

.hg-notice__tag {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.28);
  font-weight: 700;
  font-size: 12px;
}

/* —— Sections / cards —— */
.hg-section {
  margin-bottom: 36px;
}

.hg-section--tight {
  margin-top: 28px;
}

.hg-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.hg-section__header h2 {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 22px;
}

.hg-section__accent {
  width: 4px;
  height: 18px;
  border-radius: 4px;
  background: var(--hg-btn-gradient);
}

.hg-section__header a {
  color: #aaa;
  font-size: 13px;
}

.hg-section__header a:hover {
  color: var(--color-primary);
}

.hg-card-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px;
}

.hg-drama-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.hg-drama-card__cover {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 12px;
  overflow: hidden;
  background: #1a1a1a;
}

.hg-drama-card__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}

.hg-drama-card:hover .hg-drama-card__cover img {
  transform: scale(1.04);
}

.hg-drama-card__score {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.65);
  color: var(--color-primary);
  font-size: 12px;
  font-weight: 700;
}

.hg-drama-card__episode {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 28px 8px 8px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
  color: #eee;
  font-size: 12px;
}

.hg-drama-card__title {
  font-size: 14px;
  font-weight: 650;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hg-drama-card--list-only .hg-drama-card__cover {
  outline: 1px solid rgba(255, 200, 80, 0.35);
  outline-offset: -1px;
}

.hg-drama-card--list-only .hg-drama-card__score {
  color: #ffc850;
}

.hg-cover-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: #666;
  font-size: 13px;
  background: linear-gradient(160deg, #222, #111);
}

.hg-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.hg-page-head h1 {
  margin: 0 0 6px;
  font-size: 28px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 28px;
}

.pagination button {
  min-height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid #333;
  background: #181818;
  color: #eee;
  cursor: pointer;
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* —— Detail —— */
.hg-breadcrumb {
  margin-bottom: 14px;
  color: #aaa;
  font-size: 13px;
}

.hg-breadcrumb a:hover {
  color: var(--color-primary);
}

.hg-detail {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 28px;
  padding: 22px;
  border-radius: 18px;
  background: var(--color-panel);
  border: 1px solid #1c1c1c;
}

.hg-detail__poster {
  aspect-ratio: 3 / 4;
  border-radius: 14px;
  overflow: hidden;
  background: #1a1a1a;
}

.hg-detail__poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hg-detail__title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.hg-detail__title-row h1 {
  margin: 0;
  font-size: clamp(24px, 4vw, 34px);
}

.hg-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 210, 28, 0.15);
  color: var(--color-primary);
  font-size: 12px;
  font-weight: 700;
}

.hg-detail__meta {
  margin: 0 0 16px;
  color: #aaa;
  font-size: 13px;
  line-height: 1.7;
}

.hg-detail__desc-title {
  margin: 0 0 8px;
  font-size: 15px;
}

.hg-detail__desc {
  margin: 0 0 20px;
  color: #c8c8c8;
  font-size: 14px;
  line-height: 1.75;
  max-width: 62ch;
}

.hg-detail__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hg-ep-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 10px;
}

.hg-ep-grid--compact {
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  max-height: min(70vh, 640px);
  overflow: auto;
  padding-right: 4px;
}

.hg-ep {
  min-height: 40px;
  border: 0;
  border-radius: 10px;
  background: #222;
  color: #eee;
  cursor: pointer;
  font-weight: 650;
}

.hg-ep:hover {
  background: #333;
}

.hg-ep.is-active {
  color: #111;
  background: var(--hg-btn-gradient);
}

/* —— Play —— */
.hg-play {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 18px;
  align-items: start;
}

.hg-play__player {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  border: 1px solid #1c1c1c;
}

.hg-play__player video {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
  object-fit: contain;
}

.hg-play__empty,
.hg-play__loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.55);
  color: #ddd;
  font-size: 14px;
  pointer-events: none;
}

.hg-play__loading img {
  width: 42px;
  height: 42px;
}

.hg-play__loading[hidden],
.hg-play__empty[hidden] {
  display: none !important;
}

.hg-play__bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.hg-play__bar h2 {
  margin: 0 0 6px;
  font-size: 20px;
}

.hg-play__controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.hg-play__side {
  padding: 16px;
  border-radius: 14px;
  background: var(--color-panel);
  border: 1px solid #1c1c1c;
}

.track-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.track-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.track-label {
  color: #999;
  font-size: 12px;
}

.track-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.track-buttons button {
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid #333;
  background: #1a1a1a;
  color: #ddd;
  cursor: pointer;
  font-size: 12px;
}

.track-buttons button.active {
  color: #111;
  border-color: transparent;
  background: var(--hg-btn-gradient);
  font-weight: 700;
}

#status.error {
  color: #ff7b7b;
}

#toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 80;
  transform: translateX(-50%) translateY(12px);
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(20, 20, 20, 0.95);
  border: 1px solid #333;
  color: #fff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

#toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 1100px) {
  .hg-card-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .hg-header {
    height: auto;
  }

  .hg-header__inner {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      'logo search'
      'menu menu';
    align-items: center;
    height: auto;
    padding: 10px 0;
    gap: 10px 12px;
  }

  .hg-header__logo {
    grid-area: logo;
  }

  .hg-header__logo-mark {
    display: none;
  }

  .hg-header__search {
    grid-area: search;
    width: 100%;
    min-width: 0;
    margin-left: 0;
  }

  .hg-header__menu {
    grid-area: menu;
    width: 100%;
    min-width: 0;
  }

  .hg-card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hg-detail {
    grid-template-columns: 140px minmax(0, 1fr);
    gap: 16px;
    padding: 14px;
  }

  .hg-play {
    grid-template-columns: 1fr;
  }

  .hg-hero__thumbs {
    max-width: calc(100% - 32px);
  }
}

@media (max-width: 560px) {
  .hg-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .hg-page-head,
  .hg-play__bar {
    flex-direction: column;
    align-items: stretch;
  }

  .hg-detail {
    grid-template-columns: 1fr;
  }

  .hg-detail__poster {
    max-width: 220px;
  }
}
