/* =====================================================
   全站响应式适配（手机 / 平板）v2
   覆盖 PC 固定宽度布局 + JS inline style（用 !important）
   2026-10-19
   ===================================================== */

/* ---------- 平板 <=1100px ---------- */
/* ===== 基础规则（全端生效，媒体查询内再按需覆盖） ===== */
/* 礼物图标按钮：所有端显示（PC + 移动统一，点击弹出礼物面板） */
.MR-talk .gift-icon-btn {
  display: block;
  position: absolute;
  top: 1px;
  right: 64px;
  width: 32px;
  height: 30px;
  line-height: 30px;
  text-align: center;
  border-radius: 6px;
  background: rgba(255, 204, 52, 0.16);
  border: 1px solid rgba(255, 204, 52, 0.45);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.MR-talk .gift-icon-btn.on {
  background: #ffcc34;
}
.MR-talk .gift-icon-btn svg {
  vertical-align: middle;
  pointer-events: none;
}
/* 礼物面板头部条：所有端显示 */
.gift-m-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 34px;
  padding: 0 14px;
  color: #fff;
  font-size: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
/* 礼物面板：所有端默认隐藏，点击图标弹出底部浮层 */
.SR-area-video .chat-gift {
  display: none !important;
}
.SR-area-video .chat-gift.open {
  display: block !important;
  position: fixed !important;
  left: 50% !important;
  right: auto !important;
  bottom: 0 !important;
  top: auto !important;
  width: 520px !important;
  max-width: 100% !important;
  transform: translateX(-50%);
  height: auto !important;
  z-index: 3000 !important;
  background: rgba(26, 14, 44, 0.97) !important;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.55);
  box-sizing: border-box;
  padding-bottom: 8px;
}
/* 弹出面板礼物列表：多行网格（每行 5 个） */
.SR-area-video .chat-gift.open .M-arrow-scroll .con {
  width: 100% !important;
  height: auto !important;
  overflow: visible !important;
  padding-top: 0 !important;
}
.SR-area-video .chat-gift.open .gift-wrap {
  padding-left: 8px !important;
  padding-right: 8px !important;
  box-sizing: border-box;
}
.SR-area-video .chat-gift.open .M-arrow-scroll .left-arrow,
.SR-area-video .chat-gift.open .M-arrow-scroll .right-arrow {
  display: none !important;
}
.SR-area-video .chat-gift.open .con .scroll,
.SR-area-video .chat-gift.open .con .scroll ul {
  width: 100% !important;
  height: auto !important;
}
.SR-area-video .chat-gift.open .con .scroll ul {
  display: flex !important;
  flex-wrap: wrap !important;
}
.SR-area-video .chat-gift.open .gift-con li.gift {
  display: block !important;
  float: none !important;
  flex: 0 0 calc(20% - 4px) !important;
  width: calc(20% - 4px) !important;
  height: 48px;
  margin: 6px 2px !important;
  box-sizing: border-box;
}

@media (max-width: 1100px) {
  body {
    min-width: 0;
  }
  .container {
    width: auto;
    max-width: 1100px;
    padding: 0 12px;
    box-sizing: border-box;
  }
  .wrapper {
    width: 100%;
    min-width: 0;
  }
  #focuspic .list {
    width: 100%;
    box-sizing: border-box;
  }
}

/* ---------- 手机 <=768px ---------- */
@media (max-width: 768px) {
  /* 通用容器 */
  .container {
    width: 100%;
    padding: 0 8px;
    box-sizing: border-box;
  }
  .wrapper {
    width: 100%;
    overflow-x: hidden;
  }
  body {
    min-width: 0 !important;
    overflow-x: hidden;
  }

  /* ===== 顶部导航 ===== */
  .topbar {
    height: auto !important;
    padding: 4px 0;
  }
  #doc-hd .container {
    padding: 0 8px;
    height: auto !important;
  }
  .hd-logo {
    float: left !important;
    margin-top: 6px !important;
  }
  .hd-nav {
    float: left !important;
    width: auto !important;
    height: auto !important;
    margin: 6px 0 0 8px !important;
    white-space: nowrap;
  }
  .hd-nav .item {
    margin: 0 1px;
  }
  .hd-nav .item a {
    display: inline-block;
    height: 30px;
    line-height: 30px;
    font-size: 12px;
    padding: 0 4px;
  }
  .hd-login {
    position: absolute !important;
    top: 6px !important;
    right: 10px !important;
    float: none !important;
    margin: 0 !important;
  }
  .hd-login .no-login .icon-avatar,
  .hd-login .no-login .icon-level,
  .hd-login .no-login .icon-more,
  .hd-login .already-login .nickname,
  .hd-login .already-login .icon-more,
  .hd-login .already-login .icon-level,
  .hd-login .huajiaodou {
    display: none;
  }
  .search-bar {
    display: none;
  }
  #top-header-position {
    display: none !important;
  }

  /* ===== 容器宽度归位（index.css 固定 1200/1180px 的容器是布局根基）===== */
  #focuspic {
    width: 100% !important;
  }
  #focuspic .list,
  .g-box .box-bd .list,
  .feed-list > .list,
  ul.list {
    width: 100% !important;
    padding-left: 4px !important;
    padding-right: 4px !important;
    box-sizing: border-box;
  }
  .gray_line {
    width: 100% !important;
  }
  .main_top_pic {
    text-align: center;
  }
  .main_top_pic img {
    max-width: 100% !important;
    height: auto !important;
  }
  .fullSlide {
    width: 100% !important;
    height: auto !important;
    overflow: hidden;
  }
  .fullSlide .bd ul {
    height: 150px !important;
  }

  /* ===== 浮动客服/二维码（遮挡内容，手机隐藏）===== */
  .fix_area,
  .go_top {
    display: none !important;
  }

  /* ===== 首页直播区：视频全宽 16:9，侧栏缩略隐藏 ===== */
  .scroll_top {
    width: 100% !important;
    height: auto !important;
    margin-top: 10px !important;
  }
  .index_live {
    width: 100% !important;
    height: auto !important;
  }
  .index_live_area {
    width: 100% !important;
    height: auto !important;
  }
  .index_live {
    width: 100%;
  }
  .index_live_area {
    width: 100%;
  }
  .index_live_area_left {
    width: 100% !important;
    float: none;
    height: auto !important;
  }
  .index_live_area_left #video {
    width: 100% !important;
    height: 56.25vw !important;
    max-height: 70vh;
  }
  .index_live_area_left .video_mask {
    width: 100% !important;
    height: 100% !important;
  }
  .index_live_area_right {
    display: none;
  }

  /* ===== 轮播：固定高度 + 背景裁切，防止撑高 ===== */
  .fullSlide .bd ul {
    height: 150px !important;
  }
  .fullSlide .bd ul li {
    height: 150px !important;
    background-size: cover !important;
    background-position: center top !important;
  }
  .fullSlide .bd ul li img {
    width: 100%;
    height: auto;
  }

  /* ===== 热门直播区（focuspic）：1180px 固定宽 → 全宽两列 ===== */
  #focuspic .list {
    width: 100% !important;
    padding: 0 4px !important;
    box-sizing: border-box;
  }
  #focuspic .list .feed {
    width: calc(50% - 8px) !important;
    margin: 4px !important;
    height: auto !important;
    box-sizing: border-box;
  }
  #focuspic .list .feed .link .screenshot {
    height: auto !important;
    aspect-ratio: 1 / 1;
    object-fit: cover;
  }
  #focuspic .list .feed .link .user {
    margin-top: -60px !important;
    height: 60px !important;
  }
  #focuspic .list .feed .link .user .username {
    margin-top: 32px !important;
  }
  #focuspic .list .feed .link .user .watches {
    margin-top: 32px !important;
  }

  /* ===== 直播列表（最新直播等）：两列网格 ===== */
  .feed-list .feed,
  ul.list .feed {
    width: calc(50% - 12px) !important;
    height: auto !important;
    margin: 6px !important;
    box-sizing: border-box;
  }
  .feed-list .feed .link {
    height: auto;
  }
  .feed-list .feed img.screenshot,
  ul.list .feed img.screenshot {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
    object-fit: cover;
  }
  .feed-list .feed .user,
  ul.list .feed .user {
    height: auto;
    padding: 6px 8px;
    box-sizing: border-box;
  }
  .feed-list .feed .user .user_left,
  ul.list .feed .user .user_left {
    width: 40px;
  }
  .feed-list .feed .user .user_left img,
  ul.list .feed .user .user_left img {
    width: 36px;
    height: 36px;
  }
  .feed-list .feed .user .user_right,
  ul.list .feed .user .user_right {
    width: auto;
    max-width: calc(100% - 52px);
  }
  .feed-list .feed .username,
  ul.list .feed .username {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* ===== 页脚 ===== */
  .down-ft_one,
  .down-ft_two,
  .down-ft_three,
  .down-ft_four,
  .area-ft .down-ft_one,
  .area-ft .down-ft_two,
  .area-ft .down-ft_three,
  .area-ft .down-ft_four {
    float: none !important;
    width: 100% !important;
    margin: 12px 0 !important;
    text-align: center;
    box-sizing: border-box;
  }
  .ewm_list,
  .area-ft .ewm_list {
    width: 100% !important;
    text-align: center;
    padding: 0;
    margin: 0;
  }
  .ewm_list li,
  .area-ft .ewm_list li {
    display: inline-block;
    float: none;
    margin: 0 15px;
  }
  .href_list,
  .area-ft .href_list {
    float: none !important;
    width: 100% !important;
    text-align: center;
    margin: 8px 0 !important;
  }
  #doc-ft {
    padding: 12px 0;
  }
  #doc-ft .footer {
    font-size: 12px;
    padding: 0 10px;
  }

  /* ===== 直播间（PC 版 Show 页）=====
     页面 JS 会用 inline style 写死区块尺寸，
     这里全部用 !important 覆盖 */
  .SR-pager {
    min-width: 0 !important;
    width: 100% !important;
  }
  .SR-nav {
    display: none !important;
  }
  .SR-stager {
    width: 100% !important;
    margin: 0 !important;
    padding-top: 0 !important;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
  }
  /* 视频区排最上（DOM 中聊天在前） */
  .SR-area-video {
    order: -1;
    width: 100% !important;
    float: none !important;
    height: 56.25vw !important;
    max-height: 62vh;
    position: relative;
    background: #000;
  }
  .SR-area-video .channel-player-v2,
  .SR-area-video #playerzmblbkjP {
    width: 100% !important;
    height: 100% !important;
  }
  /* 礼物悬浮按钮：JS 按旧宽度定位到屏幕外，拉回右缘 */
  .hjPopGift {
    left: auto !important;
    right: 8px !important;
  }
  .SR-area-chat {
    order: 0;
    width: 100% !important;
    float: none !important;
    height: calc(100vh - 56.25vw) !important;
    min-height: 300px;
    position: relative;
    box-sizing: border-box;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }
  .SR-area-chat .chat-msg {
    width: 100% !important;
    float: none !important;
    box-sizing: border-box;
    flex: 1 1 auto !important;
    height: auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  .SR-area-chat .chat-talk {
    position: relative !important;
    bottom: 0;
    flex: 0 0 auto !important;
  }

  /* ===== 移动端礼物改造：面板默认隐藏，发送栏图标点击弹出 ===== */
  /* 礼物面板（JS 移入视频区）默认隐藏 */
  .SR-area-video .chat-gift {
    display: none !important;
  }
  /* 弹出态：底部浮层 */
  .SR-area-video .chat-gift.open {
    display: block !important;
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    width: 100% !important;
    height: auto !important;
    z-index: 3000 !important;
    background: rgba(26, 14, 44, 0.97) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.55);
    box-sizing: border-box;
    padding-bottom: 8px;
  }
  /* 弹出面板头部（标题 + 关闭） */
  .SR-area-video .chat-gift.open .gift-m-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 34px;
    padding: 0 14px;
    color: #fff;
    font-size: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }
  .gift-m-head .gift-m-close {
    display: inline-block;
    width: 26px;
    height: 26px;
    line-height: 24px;
    text-align: center;
    font-size: 18px;
    color: #bbb;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
  }
  /* 弹出面板内容自适应宽度 */
  .SR-area-video .chat-gift.open .MR-gift,
  .SR-area-video .chat-gift.open .gift-panel,
  .SR-area-video .chat-gift.open .gift-con,
  .SR-area-video .chat-gift.open .gift-tab {
    width: 100% !important;
    box-sizing: border-box;
  }
  /* 礼物列表：多行网格（每行 5 个），取消单行横向滚动 */
  .SR-area-video .chat-gift.open .M-arrow-scroll .con {
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
    padding-top: 0 !important;
  }
  .SR-area-video .chat-gift.open .gift-wrap {
    padding-left: 8px !important;
    padding-right: 8px !important;
    box-sizing: border-box;
  }
  .SR-area-video .chat-gift.open .M-arrow-scroll .left-arrow,
  .SR-area-video .chat-gift.open .M-arrow-scroll .right-arrow {
    display: none !important;
  }
  .SR-area-video .chat-gift.open .con .scroll,
  .SR-area-video .chat-gift.open .con .scroll ul {
    width: 100% !important;
    height: auto !important;
  }
  .SR-area-video .chat-gift.open .con .scroll ul {
    display: flex !important;
    flex-wrap: wrap !important;
  }
  .SR-area-video .chat-gift.open .gift-con li.gift {
    display: block !important; /* 覆盖 JS 按宽度隐藏的礼物 */
    float: none !important;
    flex: 0 0 calc(20% - 4px) !important;
    width: calc(20% - 4px) !important;
    height: 48px;
    margin: 6px 2px !important;
    box-sizing: border-box;
  }

  /* 发送栏礼物图标按钮（PC 隐藏，见文件顶部基础规则） */
  .MR-talk .gift-icon-btn {
    display: block;
    position: absolute;
    top: 1px;
    right: 64px;
    width: 32px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    border-radius: 6px;
    background: rgba(255, 204, 52, 0.16);
    border: 1px solid rgba(255, 204, 52, 0.45);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .MR-talk .gift-icon-btn.on {
    background: #ffcc34;
  }
  .MR-talk .gift-icon-btn svg {
    vertical-align: middle;
    pointer-events: none;
  }
  /* 发送栏布局：输入框 + 弹幕 + 礼物 + 发送，互不重叠 */
  .MR-talk {
    width: 100% !important;
    max-width: 360px;
  }
  .MR-talk .speaker {
    width: auto !important;
    left: 0 !important;
    right: 140px !important;
  }
  .MR-talk .speaker input {
    width: calc(100% - 22px) !important;
  }
  /* 弹幕/喇叭按钮：礼物图标左侧（已移入 MR-talk，与图标同一定位基准） */
  .MR-horn {
    right: 104px !important;
    top: 1px !important;
    z-index: 5;
  }
  /* 弹幕选择弹窗与弹幕输入框：屏幕内居中浮层 */
  .MR-horn .selector,
  .MR-horn .dialog {
    position: fixed !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    top: auto !important;
    bottom: 96px !important;
    width: 340px !important;
    max-width: calc(100vw - 24px) !important;
    box-sizing: border-box;
  }
  .MR-horn .dialog textarea {
    width: 100% !important;
    box-sizing: border-box;
  }

  /* ===== 门户下载页（portal/index）===== */
  .content {
    width: 100% !important;
    height: auto !important;
    margin: 20px auto !important;
  }
  .content .log {
    width: 100% !important;
    height: auto;
    top: 0 !important;
    text-align: center;
  }
  .content .log img {
    max-width: 96%;
    height: auto;
  }
  .content .erweima,
  .content .erweima1 {
    top: 20px !important;
    width: 130px;
    height: 130px;
  }
  .content .button {
    width: 100% !important;
    top: 40px !important;
    left: 0 !important;
    text-align: center;
  }
  /* 按钮单列堆叠；hover 备用按钮(.display)保持隐藏 */
  .content .button a {
    display: block !important;
    width: 72% !important;
    margin: 12px auto !important;
  }
  .content .button a.display {
    display: none !important;
  }
  .content .button a img {
    width: 100%;
    height: auto;
  }
  .content .button .adr {
    left: 0 !important;
  }
  .content .foot {
    width: 90% !important;
    top: 60px !important;
    font-size: 12px;
  }
}

/* ---------- 小屏手机 <=375px ---------- */
@media (max-width: 375px) {
  .hd-nav .item a {
    font-size: 12px;
    padding: 0 3px;
  }
  .hd-login {
    font-size: 12px;
  }
  .feed-list .feed,
  ul.list .feed,
  #focuspic .list .feed {
    width: calc(50% - 8px) !important;
    margin: 4px !important;
  }
  .feed-list .feed .user .user_left,
  ul.list .feed .user .user_left {
    display: none;
  }
  .feed-list .feed .user .user_right,
  ul.list .feed .user .user_right {
    max-width: 100%;
  }
}
