.hg-mobile-player-controls,
.hg-mobile-exit-fullscreen,
.hg-mobile-social,
.hg-mobile-series,
.hg-mobile-nav {
  display: none;
}

@media (max-width: 760px), (hover: none) and (pointer: coarse) {
  html.hg-h5,
  html.hg-h5 body,
  html.hg-h5 #app,
  html.hg-h5 .frame {
    width: 100%;
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
  }

  html.hg-h5 .titlebar,
  html.hg-h5 .sidebar {
    display: none !important;
  }

  html.hg-h5 .shell,
  html.hg-h5 .main,
  html.hg-h5 .feed,
  html.hg-h5 .pv-shell,
  html.hg-h5 .player-view {
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
  }

  html.hg-h5 .page {
    padding: 16px 14px calc(76px + env(safe-area-inset-bottom));
  }

  html.hg-h5 .modal-mask {
    align-items: flex-end;
    padding: 0;
  }

  html.hg-h5 .modal {
    width: 100%;
    max-height: 82dvh;
    border-radius: 8px 8px 0 0;
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }

  html.hg-h5 .pv-shell.with-comments {
    display: block !important;
    grid-template-columns: 1fr !important;
  }

  html.hg-h5 .drawer {
    position: fixed !important;
    inset: 0 !important;
    z-index: 3600 !important;
    width: 100% !important;
    height: 100% !important;
    height: 100dvh !important;
    padding-bottom: env(safe-area-inset-bottom);
  }

  html.hg-h5 .player-view,
  html.hg-h5 .xgplayer,
  html.hg-h5 .player-view * {
    -webkit-touch-callout: none;
  }

  html.hg-h5 .player-view {
    touch-action: pan-x;
    transform: translate3d(0, var(--hg-swipe-y, 0), 0);
    opacity: var(--hg-swipe-opacity, 1);
    user-select: none;
  }

  html.hg-h5 .player-view.hg-mobile-swiping {
    will-change: transform, opacity;
  }

  html.hg-h5 .player-view.hg-mobile-swipe-animate {
    transition:
      transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
      opacity 180ms ease;
    will-change: transform, opacity;
  }

  html.hg-h5 .cat-bar {
    top: calc(8px + env(safe-area-inset-top)) !important;
    left: 12px !important;
    right: 12px !important;
    max-width: none;
    transform: none !important;
    overflow-x: auto;
    scrollbar-width: none;
    white-space: nowrap;
  }

  html.hg-h5 .cat-chip {
    min-width: max-content;
    flex: 0 0 auto;
    white-space: nowrap;
    word-break: keep-all;
    writing-mode: horizontal-tb;
  }

  html.hg-h5 .cat-bar::-webkit-scrollbar {
    display: none;
  }

  html.hg-h5-recommend .topbar,
  html.hg-h5 .side {
    display: none !important;
  }

  html.hg-h5 .compact-actions {
    display: none !important;
  }

  html.hg-h5-recommend .cat-bar,
  html.hg-h5-recommend .info,
  html.hg-h5-recommend .rail,
  html.hg-h5-watch .topbar,
  html.hg-h5-watch .info,
  html.hg-h5-watch .rail {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }

  html.hg-h5 .rail {
    display: none !important;
  }

  html.hg-h5 .rail-item {
    min-width: 44px;
  }

  html.hg-h5-watch .rail-item.fav {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  html.hg-h5 .rail-ico {
    font-size: 27px;
  }

  html.hg-h5 .info {
    left: 12px;
    right: 68px;
    bottom: calc(88px + env(safe-area-inset-bottom));
    max-width: none;
  }

  html.hg-h5 .info-intro {
    -webkit-line-clamp: 2;
  }

  html.hg-h5 .ep-panel {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    max-height: 68dvh !important;
    padding-bottom: env(safe-area-inset-bottom);
    border-width: 1px 0 0 !important;
    border-radius: 8px 8px 0 0 !important;
    z-index: 3100 !important;
  }

  html.hg-h5-measuring .ep-panel {
    visibility: hidden !important;
    pointer-events: none !important;
  }

  html.hg-h5-entering-watch body::after {
    position: fixed;
    inset: 0;
    z-index: 10000;
    content: "";
    background: #101014;
  }

  html.hg-h5-entering-watch body::before {
    position: fixed;
    left: 50%;
    top: 50%;
    z-index: 10001;
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255, 255, 255, 0.22);
    border-top-color: #fff;
    border-radius: 50%;
    content: "";
    transform: translate(-50%, -50%);
    animation: hg-mobile-spin 0.75s linear infinite;
  }

  @keyframes hg-mobile-spin {
    to {
      transform: translate(-50%, -50%) rotate(360deg);
    }
  }

  html.hg-h5 .ep-head {
    min-height: 52px;
  }

  html.hg-h5 .ep-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
  }

  html.hg-h5 .ep {
    height: 42px;
  }

  html.hg-h5 .xgplayer-controls {
    bottom: calc(54px + env(safe-area-inset-bottom)) !important;
  }

  html.hg-h5 .player-view:not(.hg-mobile-controls-visible) .xgplayer-controls {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  html.hg-h5 .player-view.hg-mobile-controls-visible .xgplayer-controls,
  html.hg-h5 .player-view.hg-mobile-controls-visible .xgplayer-start {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }

  html.hg-h5 .xgplayer-volume,
  html.hg-h5 .xg-dm-send,
  html.hg-h5 .xg-rate,
  html.hg-h5 .xg-extra > .xg-btn,
  html.hg-h5 .xg-extra > .xg-sel {
    display: none !important;
  }

  html.hg-h5 .xgplayer xg-icon {
    margin-left: 5px;
    margin-right: 5px;
  }

  html.hg-h5 .xgplayer-time {
    font-size: 12px;
  }

  html.hg-h5 .xgplayer-fullscreen {
    display: none !important;
  }

  .hg-mobile-player-controls {
    position: absolute;
    inset: 0;
    z-index: 40;
    pointer-events: none;
    opacity: 0;
    display: block;
    transition: opacity 0.18s ease;
  }

  .player-view.hg-mobile-controls-visible .hg-mobile-player-controls {
    opacity: 1;
  }

  html.hg-h5-watch .hg-mobile-player-controls {
    opacity: 1;
  }

  .hg-mobile-player-controls button {
    position: absolute;
    display: grid;
    place-items: center;
    border: 0;
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.28);
    pointer-events: none;
    touch-action: manipulation;
  }

  .player-view.hg-mobile-controls-visible .hg-mobile-player-controls button {
    pointer-events: auto;
  }

  html.hg-h5-watch .hg-mobile-player-controls button {
    pointer-events: auto;
  }

  html.hg-h5-watch .player-view:not(.hg-mobile-controls-visible) .hg-mobile-play {
    opacity: 0;
    pointer-events: none;
  }

  .hg-mobile-play {
    left: 50%;
    top: 50%;
    width: 58px;
    height: 58px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    font-size: 25px;
    line-height: 1;
  }

  .hg-mobile-action {
    top: calc(12px + env(safe-area-inset-top));
    height: 38px;
    min-width: 42px;
    padding: 0 12px;
    border-radius: 19px;
    font-size: 14px;
    font-weight: 600;
  }

  .hg-mobile-episodes {
    left: 12px;
  }

  .hg-mobile-danmaku {
    top: calc(52px + env(safe-area-inset-top));
    left: 12px;
    bottom: auto;
    min-width: 64px;
    color: #b9b9c2;
  }

  .hg-mobile-danmaku.on {
    color: #fff;
    background: rgba(232, 49, 83, 0.78);
  }

  html.hg-h5-recommend .hg-mobile-episodes {
    display: none;
  }

  html.hg-h5-watch .hg-mobile-episodes {
    display: none;
  }

  html.hg-h5-recommend .hg-mobile-danmaku {
    left: 12px;
  }

  html.hg-h5-watch .hg-mobile-danmaku {
    top: calc(58px + env(safe-area-inset-top));
    right: 12px;
    bottom: auto;
    left: auto;
  }

  html.hg-h5-watch .hg-mobile-fullscreen {
    top: auto;
    bottom: calc(68px + env(safe-area-inset-bottom));
  }

  .hg-mobile-clean {
    top: calc(58px + env(safe-area-inset-top));
    left: 12px;
    bottom: auto;
    min-width: 58px;
  }

  html.hg-h5-recommend .hg-mobile-clean {
    display: none;
  }

  html.hg-h5-recommend .hg-mobile-fullscreen {
    top: auto;
    bottom: calc(124px + env(safe-area-inset-bottom));
  }

  .hg-mobile-fullscreen {
    right: 12px;
    font-size: 22px;
  }

  .hg-mobile-exit-fullscreen {
    position: absolute;
    top: calc(14px + env(safe-area-inset-top));
    right: calc(14px + env(safe-area-inset-right));
    z-index: 3300;
    height: 40px;
    padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, 0.26);
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.62);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    touch-action: manipulation;
  }

  .hg-mobile-series {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(56px + env(safe-area-inset-bottom));
    z-index: 45;
    height: 58px;
    min-width: 0;
    padding: 0 16px;
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(31, 31, 35, 0.96);
    color: #fff;
    align-items: center;
    gap: 10px;
    text-align: left;
    touch-action: manipulation;
  }

  html.hg-h5-recommend .hg-mobile-series,
  html.hg-h5-watch .hg-mobile-series {
    display: flex;
  }

  html.hg-h5-watch .hg-mobile-series {
    bottom: env(safe-area-inset-bottom);
  }

  .hg-mobile-series-icon {
    display: grid;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    place-items: center;
    border-radius: 5px;
    background: #fff;
    color: #17171a;
    font-size: 11px;
  }

  .hg-mobile-series-label {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    font-size: 15px;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .hg-mobile-series-arrow {
    flex: 0 0 auto;
    color: #d7d7dd;
    font-size: 30px;
    font-weight: 300;
  }

  .hg-mobile-social {
    position: absolute;
    right: 6px;
    bottom: calc(112px + env(safe-area-inset-bottom));
    z-index: 55;
    flex-direction: column;
    align-items: center;
    gap: 7px;
  }

  html.hg-h5-recommend .hg-mobile-social,
  html.hg-h5-watch .hg-mobile-social {
    display: flex;
  }

  html.hg-h5-recommend .hg-mobile-social {
    bottom: calc(150px + env(safe-area-inset-bottom));
  }

  .hg-mobile-social-button {
    display: grid;
    width: 50px;
    min-height: 50px;
    place-items: center;
    gap: 1px;
    padding: 2px 0;
    border: 0;
    background: transparent;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.86);
    touch-action: manipulation;
  }

  .hg-mobile-social-icon {
    font-size: 29px;
    line-height: 30px;
  }

  .hg-mobile-social-count {
    max-width: 50px;
    overflow: hidden;
    font-size: 11px;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .hg-mobile-social-button.on .hg-mobile-social-icon {
    color: #ff496c;
  }

  html.hg-h5-recommend .info {
    bottom: calc(142px + env(safe-area-inset-bottom));
    z-index: 31;
  }

  html.hg-h5-recommend .rail {
    bottom: calc(154px + env(safe-area-inset-bottom));
    z-index: 32;
  }

  html.hg-h5 .rail-item[title^="下载"],
  html.hg-h5 .rail-item[title^="不感兴趣"] {
    display: none !important;
  }

  html.hg-h5-recommend .xgplayer-controls {
    bottom: calc(114px + env(safe-area-inset-bottom)) !important;
  }

  html.hg-h5-watch .info {
    bottom: calc(130px + env(safe-area-inset-bottom));
  }

  html.hg-h5-watch .rail {
    bottom: calc(88px + env(safe-area-inset-bottom));
  }

  html.hg-h5-watch .xgplayer-controls {
    bottom: calc(58px + env(safe-area-inset-bottom)) !important;
  }

  .hg-mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3000;
    height: calc(56px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 0 6px env(safe-area-inset-bottom);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(14, 14, 18, 0.94);
    backdrop-filter: blur(12px);
  }

  .hg-mobile-nav button {
    min-width: 0;
    border: 0;
    background: transparent;
    color: #aaaab8;
    font-size: 13px;
    font-weight: 600;
    touch-action: manipulation;
  }

  .hg-mobile-nav button.active {
    color: #fff;
  }

  html.hg-h5-fullscreen .hg-mobile-nav {
    display: none;
  }

  html.hg-h5-fullscreen .hg-mobile-exit-fullscreen {
    display: block;
  }

  html.hg-h5-watch .hg-mobile-nav {
    display: none;
  }

  html.hg-h5-fullscreen .hg-mobile-series {
    display: none;
  }

  html.hg-h5-fullscreen .topbar,
  html.hg-h5-fullscreen .cat-bar,
  html.hg-h5-fullscreen .info,
  html.hg-h5-fullscreen .rail {
    display: none !important;
  }

  html.hg-h5-fullscreen .hg-mobile-social,
  html.hg-h5-clean .hg-mobile-social {
    display: none !important;
  }

  html.hg-h5-fullscreen .xgplayer-controls {
    bottom: env(safe-area-inset-bottom) !important;
  }

  html.hg-h5-fullscreen .info {
    bottom: calc(44px + env(safe-area-inset-bottom));
  }

  html.hg-h5-fullscreen .rail {
    bottom: calc(64px + env(safe-area-inset-bottom));
  }

  html.hg-h5-fullscreen,
  html.hg-h5-fullscreen body,
  html.hg-h5-fullscreen #app,
  html.hg-h5-fullscreen .frame,
  html.hg-h5-fullscreen .shell,
  html.hg-h5-fullscreen .main,
  html.hg-h5-fullscreen .feed,
  html.hg-h5-fullscreen .pv-shell {
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
    background: #000 !important;
  }

  html.hg-h5-fullscreen .player-view {
    position: fixed !important;
    inset: 0 !important;
    z-index: 3200 !important;
    width: 100vw !important;
    height: 100dvh !important;
    background: #000 !important;
  }

  html.hg-h5-fullscreen .hg-mobile-player-controls {
    opacity: 1;
  }

  html.hg-h5-fullscreen .hg-mobile-fullscreen {
    display: none;
  }

  html.hg-h5-fullscreen .hg-mobile-clean {
    display: none;
  }

  html.hg-h5-clean .topbar,
  html.hg-h5-clean .cat-bar,
  html.hg-h5-clean .info,
  html.hg-h5-clean .rail,
  html.hg-h5-clean .hg-mobile-series,
  html.hg-h5-clean .hg-mobile-danmaku,
  html.hg-h5-clean .hg-mobile-fullscreen,
  html.hg-h5-clean .hg-mobile-play,
  html.hg-h5-clean .xgplayer-controls {
    display: none !important;
  }

  html.hg-h5-clean .hg-mobile-clean {
    display: grid !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  @media (orientation: portrait) {
    html.hg-h5-fullscreen .player-view {
      top: 50% !important;
      left: 50% !important;
      right: auto !important;
      bottom: auto !important;
      width: 100dvh !important;
      height: 100vw !important;
      transform: translate(-50%, -50%) rotate(90deg) !important;
      transform-origin: center center;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    html.hg-h5 .player-view.hg-mobile-swipe-animate {
      transition-duration: 1ms;
    }
  }
}
