/* Extra rules on top of the vendored theme (only for pieces the theme lacks). */

/* ---------------------------------------------------------------- no zoom --
   The layout is a fixed-width design; once the page is pinch-zoomed or
   ctrl+wheel-zoomed the fixed header / floating tools no longer line up with
   the content and taps land on the wrong element. Keep the page at 1x. */
html, body {
  touch-action: pan-x pan-y;
  -ms-touch-action: pan-x pan-y;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overscroll-behavior: none;
}
html {
  /* iOS Safari ignores user-scalable=no, so also pin the layout viewport */
  -webkit-user-select: none;
  user-select: none;
}
input, textarea { user-select: text; -webkit-user-select: text; }

/* --------------------------------------------------------- cover fitting --
   The theme ships `img[data-src]{object-fit:contain}` for the lazy-load state,
   which leaves vertical bars next to anything that is not exactly 3:4 (the
   portrait 9:16 video frames we generate, for instance) - the cover then looks
   shrunk inside its card. Covers must always fill their box. */
.hg-drama-card__cover img,
.hg-drama-card__cover img[data-src],
.hg-web-play__poster img,
.hg-category-item__thumb img,
.hg-history-item img,
.hg-history-card__cover img,
.hg-rank-item__cover img,
.hg-hero__thumb img,
.hg-search-guess__cover img,
.hg-play__poster {
  object-fit: cover !important;
}

html.hg-locked,
html.hg-locked body { overflow: hidden; }

/* mobile search icon button (theme only ships the input) */
.hg-header__search-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, .06);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}
.hg-header__search-toggle img { display: block; }
@media (max-width: 767px) {
  .hg-header__search-toggle { display: inline-flex; }
  .hg-header__search { display: none; }
}

/* announcement strip */
.hg-announce {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 4px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 210, 28, .22);
  border-radius: 10px;
  background: rgba(255, 210, 28, .06);
  color: #e8e8e8;
  font-size: 13px;
  line-height: 20px;
}
.hg-announce span { min-width: 0; }

/* pager also rendered as buttons (client-side pages) */
button.hg-pager__page,
button.hg-pager__arrow {
  font: inherit;
  cursor: pointer;
}

/* mirror (最新地址) dialog */
.hg-mirror {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, .78);
}
.hg-mirror[hidden] { display: none; }
.hg-mirror__panel {
  width: 100%;
  max-width: 460px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 14px;
  background: #161616;
}
.hg-mirror__head { display: flex; align-items: baseline; gap: 10px; }
.hg-mirror__head b { font-size: 18px; color: #ffd21c; }
.hg-mirror__head span { font-size: 12px; color: #888; }
.hg-mirror__close {
  margin-left: auto; width: 26px; height: 26px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .08); color: #ddd; font-size: 16px; line-height: 1; cursor: pointer;
}
.hg-mirror__tip { margin: 12px 0; color: #b0b0b0; font-size: 13px; }
.hg-mirror__list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.hg-mirror__item {
  padding: 10px 12px; border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 8px; background: #1e1e1e; color: #fff; font-size: 13px; text-align: center;
}
.hg-mirror__item:hover { border-color: rgba(255, 210, 28, .5); color: #ffd21c; }
.hg-mirror__ok {
  width: 100%; margin-top: 14px; padding: 12px;
  border: 0; border-radius: 999px; background: linear-gradient(135deg, #ff9f1c, #ffd84d);
  color: #000; font-size: 14px; font-weight: 700; cursor: pointer;
}
@media (max-width: 520px) { .hg-mirror__list { grid-template-columns: 1fr; } }

/* history dialog items */
.hg-history-dialog { z-index: 1300; }
.hg-history-dialog[hidden] { display: none; }
.hg-history-dialog__empty { padding: 24px 0; color: #888; text-align: center; }
.hg-history-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .06); color: #e5e5e5; font-size: 13px;
}
.hg-history-item img { width: 48px; height: 64px; object-fit: cover; border-radius: 6px; }

/* content pages */
.hg-doc { max-width: 860px; padding: 24px 0 48px; color: #d8d8d8; font-size: 14px; line-height: 26px; }
.hg-doc h1 { margin: 8px 0 18px; font-size: 26px; color: #fff; }
.hg-doc p { margin: 0 0 14px; }

/* empty state */
.hg-empty { padding: 60px 0; color: #888; text-align: center; font-size: 14px; }
.hg-empty[hidden] { display: none; }

/* search suggestion tags */
.hg-search-suggest__tag {
  display: inline-block; margin: 0 8px 8px 0; padding: 5px 12px;
  border: 1px solid rgba(255, 255, 255, .1); border-radius: 999px;
  color: #ddd; font-size: 12px;
}
.hg-search-suggest__tag:hover { border-color: rgba(255, 210, 28, .5); color: #ffd21c; }

/* comments written by site.js */
.hg-web-play__comment { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.hg-web-play__comment-avatar {
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, #ff9f1c, #ffd84d); color: #000; font-size: 12px; font-weight: 700;
}
.hg-web-play__comment-text { color: #e5e5e5; font-size: 13px; line-height: 20px; }
.hg-web-play__comment-time { margin-top: 4px; color: #777; font-size: 12px; }

/* video element fallback sizing */
.hg-web-play__video { width: 100%; background: #000; }

/* rank rows: the theme collapses the thumbnail until a row is expanded
   (their JS only expands the rows it decorates), so show a small cover
   whenever a cover exists and keep the big one for the expanded rows. */
.hg-rank-item__cover {
  display: block;
  width: 65px !important;
  height: 80px !important;
  min-width: 65px;
  opacity: 1 !important;
  overflow: hidden;
  border-radius: 8px;
}
.hg-rank-item.is-expanded .hg-rank-item__cover {
  width: 156px !important;
  height: 192px !important;
}

/* 公告跑马灯 + 热门标签（对齐原站） */
.hg-announce{position:relative;display:flex;align-items:stretch;height:36px;margin:12px 16px 0;border-radius:8px;background:rgba(22,16,12,.78);border:1px solid rgba(196,140,48,.42);overflow:hidden}
.hg-announce__tag{display:flex;align-items:center;gap:4px;flex:0 0 auto;padding:0 12px;border-radius:7px 0 0 7px;background:linear-gradient(90deg,#ff8a00,#ffd21a);color:#111;font-size:13px;font-weight:700;line-height:1}
.hg-announce__viewport{flex:1 1 auto;min-width:0;overflow:hidden;display:flex;align-items:center}
.hg-announce__run{display:flex;align-items:center;width:max-content;animation:hg-announce-scroll 30s linear infinite;will-change:transform}
.hg-announce:hover .hg-announce__run{animation-play-state:paused}
.hg-announce__item{display:inline-flex;align-items:center;white-space:nowrap;color:#f0c14b;font-size:13px;line-height:36px}
.hg-announce__sep{color:#ffd21a;margin:0 14px}
@keyframes hg-announce-scroll{0%{transform:translateX(0)}100%{transform:translateX(-50%)}}
.hg-tagrow{position:relative;display:flex;align-items:center;gap:8px;margin:14px 16px 0}
.hg-tagrow__nav{flex:none;width:28px;height:28px;display:flex;align-items:center;justify-content:center;border-radius:8px;background:rgba(255,255,255,.06);border:1px solid rgba(255,255,255,.12);color:#ffd21c;cursor:pointer}
.hg-tagrow__nav svg{width:16px;height:16px}
.hg-tagrow__scroll{flex:1;display:flex;gap:8px;overflow-x:auto;scroll-behavior:smooth;-webkit-overflow-scrolling:touch;scrollbar-width:none}
.hg-tagrow__scroll::-webkit-scrollbar{display:none}
.hg-tagrow__item{flex:none;padding:6px 14px;border-radius:999px;background:rgba(255,255,255,.06);border:1px solid rgba(255,255,255,.1);color:#d7d7d7;font-size:13px;white-space:nowrap;text-decoration:none}

/* 竖屏短剧播放器：容器按视频比例收缩，避免左右两块大黑板 */
.hg-web-play__viewport{
  width:min(100%, calc(78vh * var(--hg-video-ar, 0.5625))) !important;
  aspect-ratio:var(--hg-video-ar, 0.5625) !important;
  max-height:78vh;
  margin:0 auto;
}
@media (max-width:1023px){
  .hg-web-play__viewport{
    width:100% !important;
    aspect-ratio:var(--hg-video-ar, 0.5625) !important;
    max-height:none;
  }
}

/* 播放器：集数角标 + 上一集/下一集 + 自动连播 */
.hg-web-play__epbadge{
  position:absolute;right:12px;top:12px;z-index:3;
  padding:5px 10px;border-radius:999px;
  background:rgba(0,0,0,.62);border:1px solid rgba(255,255,255,.18);
  color:#fff;font-size:12px;font-weight:600;backdrop-filter:blur(4px);
  pointer-events:none;
}
.hg-web-play__navbar{display:flex;align-items:center;gap:10px;margin-top:12px}
.hg-web-play__navbtn{
  flex:1;display:inline-flex;align-items:center;justify-content:center;gap:6px;
  min-height:46px;padding:0 14px;border-radius:10px;
  border:1px solid rgba(255,255,255,.14);background:#1d1d1e;color:#fff;
  font-size:14px;font-weight:600;text-decoration:none;
}
.hg-web-play__navbtn.is-next{
  border-color:rgba(255,210,28,.45);background:rgba(255,210,28,.12);color:#ffd21c;
}
.hg-web-play__navbtn.is-disabled{opacity:.35;pointer-events:none}
.hg-web-play__navbtn img{display:block}
.hg-web-play__autonext{
  flex:0 0 auto;display:inline-flex;align-items:center;gap:6px;
  height:46px;padding:0 12px;border-radius:10px;border:1px solid rgba(255,255,255,.14);
  background:#161616;color:#8a8a93;font-size:12px;cursor:pointer;
}
.hg-web-play__autonext-dot{width:7px;height:7px;border-radius:999px;background:currentColor}
.hg-web-play__autonext.is-on{color:#3ce5b6;border-color:rgba(60,229,182,.35);background:rgba(60,229,182,.08)}
.hg-web-play__actions{display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}
.hg-web-play__action{min-height:48px}
@media (max-width:640px){
  .hg-web-play__navbar{gap:8px}
  .hg-web-play__navbtn{min-height:48px;font-size:13px;padding:0 10px}
  .hg-web-play__autonext{height:48px;padding:0 10px}
  .hg-web-play__actions{grid-template-columns:repeat(2,minmax(0,1fr))}
}
