/* ------------------------------------------------------------------
 * 红楼TV 主题补丁
 * 说明：品牌色已通过批量替换写入各 CSS（#f0263c / #c3122e），
 *       这里只处理"底色变了导致前景色不合适"的组件：红底必须配白字、
 *       位图图标需要调色。
 * ------------------------------------------------------------------ */

:root {
  --hg-red-grad: linear-gradient(90deg, #ff3b4f 0%, #c3122e 100%);
  --hg-red-deep-grad: linear-gradient(-56deg, #e0203a 0%, #9e0d24 100%);
}

/* 1. 红底按钮 / 激活态：文字统一白色 */
.hg-topbar-nav__item.is-active,
.hg-header__login,
.hg-hero__play,
.hg-web-play__ep.is-active,
.hg-pill-tabs__item.is-active,
.hg-btn--primary,
.btn-primary,
.hg-mobile-nav__login,
.hg-web-play__ratesubmit:not(:disabled),
.hg-play__action.is-active {
  color: #fff !important;
  background: var(--hg-red-grad) !important;
  border-color: transparent !important;
}

/* 分页当前页 */
.hg-pager__page.is-active {
  background: var(--hg-red-grad) !important;
  color: #fff !important;
}

/* 激活态里的黑色图标 → 反白 */
.hg-hero__play img,
.hg-pill-tabs__item.is-active .hg-pill-tabs__icon,
.hg-btn--primary img,
.hg-header__login img {
  filter: brightness(0) invert(1);
}

/* 2. 卡片角标与评分：深红底 + 白字（原来的浅金渐变配白字看不清） */
.hg-drama-card__score {
  background: var(--hg-red-deep-grad) !important;
  color: #fff !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}

.hg-drama-card__badge {
  background: linear-gradient(98deg, #ff5a48 0%, #c3122e 100%) !important;
  color: #fff !important;
}

/* 3. 位图图标调色（原本是黄色） */
.hg-fab__btn--download img {
  filter: hue-rotate(325deg) saturate(1.2);
}

/* 4. 排行榜前三名的名次用品牌红，其余保持灰 */
.hg-rank-num.is-top {
  color: #ff4257;
}

/* 5. 顶部导航激活项在窄屏（移动菜单）同样白字 */
.hg-mobile-nav .hg-nav-item.is-active {
  color: #fff !important;
  background: var(--hg-red-grad) !important;
}

/* ============ 移动端布局修正 ============ */

/* 1) 顶栏在窄屏保留「菜单 + LOGO + 登录/头像 + 搜索」四个按钮，不允许换行 */
@media (max-width: 1023px) {
  .hg-header__inner {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 2px;
  }

  .hg-header__menu {
    width: 34px;
    height: 34px;
  }

  .hg-header__logo {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
  }

  .hg-header__logo img {
    height: 27px !important;
    width: auto !important;
  }

  /* 搜索按钮：绝对定位贴右，避开居中的 LOGO */
  .hg-header__search-btn {
    position: absolute !important;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    margin: 0 !important;
    z-index: 5;
  }

  a.hg-header__login {
    min-width: 0;
    height: 28px;
    padding: 0 10px;
    font-size: 12px;
  }

  /* 登录/头像：绝对定位贴右（搜索按钮左侧） */
  .hg-header__auth {
    position: absolute !important;
    right: 56px;
    top: 50%;
    transform: translateY(-50%);
    display: flex !important;
    align-items: center;
    margin: 0 !important;
    z-index: 5;
  }

  /* 2) 抽屉：原站 .base-layout .dx-drawer 是 display:none，这里按移动端打开 */
  .base-layout .dx-drawer.app-aside {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(84vw, 320px);
    z-index: 2101;
    transform: translateX(-102%);
    transition: transform .28s cubic-bezier(0, 0, .2, 1);
    box-shadow: 24px 0 60px -30px rgba(0, 0, 0, .9);
  }

  .base-layout .dx-drawer.app-aside.dx-drawer--open {
    transform: translateX(0);
    display: block;
  }

  /* 遮罩独立于抽屉（抽屉带 transform，fixed 子元素会以它为包含块） */
  .dx-drawer__mask {
    position: fixed;
    inset: 0;
    border: 0;
    padding: 0;
    background: rgba(0, 0, 0, .6);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
    z-index: 2100;
  }

  .dx-drawer__mask.is-show {
    opacity: 1;
    pointer-events: auto;
  }
}

@media (min-width: 1024px) {
  .dx-drawer__mask { display: none; }
}

/* 顶部登录按钮（原站样式只写了 button 选择器，这里补 <a> 版本） */
a.hg-header__login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 94px;
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff3b4f, #c3122e);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
}

a.hg-header__login:hover { filter: brightness(1.06); text-decoration: none; }

/* 移动端：显示头像 / 登录入口（原站设计是隐藏的，这里按需求开放） */
@media (max-width: 1023px) {
  .hg-header__auth {
    display: flex !important;
    align-items: center;
    margin-left: 2px;
    order: 6;
  }

  a.hg-header__login {
    min-width: 0;
    height: 30px;
    padding: 0 11px;
    font-size: 12px;
  }

  .hg-header__user {
    height: 32px;
    padding: 0;
    background: transparent;
    border-color: transparent;
  }

  .hg-header__user .hg-header__avatar {
    width: 30px;
    height: 30px;
    font-size: 13px;
  }
}

/* ============ 移动抽屉里的个人中心 ============ */
.hg-mobile-nav__user {
  padding: 0 12px 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.mnav-me {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  background: linear-gradient(120deg, rgba(240, 38, 60, .16), rgba(255, 255, 255, .03));
  border: 1px solid rgba(240, 38, 60, .25);
  text-decoration: none;
}

.mnav-me__avatar {
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ff3b4f, #c3122e);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
}

.mnav-me__text { min-width: 0; flex: 1; }
.mnav-me__text b { display: block; color: #fff; font-size: 15px; font-weight: 600; }
.mnav-me__text em { display: block; color: rgba(255, 255, 255, .45); font-size: 11px; font-style: normal; margin-top: 2px; }
.mnav-me__arrow { color: rgba(255, 255, 255, .35); font-size: 20px; line-height: 1; }

.mnav-quick {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.mnav-quick a {
  text-align: center;
  padding: 8px 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, .05);
  color: rgba(255, 255, 255, .72);
  font-size: 11px;
  text-decoration: none;
}

.mnav-quick a:active { background: rgba(240, 38, 60, .18); }

.mnav-logout {
  display: block;
  margin-top: 8px;
  text-align: center;
  padding: 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, .38);
  text-decoration: none;
}

.mnav-guest { padding: 4px 0 0; }
.mnav-guest__tip { font-size: 11px; color: rgba(255, 255, 255, .42); margin-bottom: 10px; line-height: 1.7; }

.mnav-guest__acts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.mnav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  background: rgba(255, 255, 255, .07);
  color: #fff;
}

.mnav-btn--pri { background: linear-gradient(90deg, #ff3b4f, #c3122e); color: #fff; }

/* 6. 顶部登录态：头像 + 昵称 + 金币 */
.hg-header__user {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px 0 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .1);
  color: #fff;
  font-size: 13px;
  text-decoration: none;
  transition: border-color .15s ease, background .15s ease;
}

.hg-header__user:hover {
  border-color: rgba(240, 38, 60, .5);
  background: rgba(240, 38, 60, .1);
  text-decoration: none;
}

.hg-header__avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ff3b4f, #c3122e);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.hg-header__uname {
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hg-header__coins {
  font-size: 11px;
  color: #ff8a95;
  background: rgba(240, 38, 60, .14);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}

@media (max-width: 1023px) {
  .hg-header__uname,
  .hg-header__coins { display: none; }
  .hg-header__user { padding: 0 4px; background: transparent; border-color: transparent; }
}
