/* ============================================================
   RA Mobile 2.0 UX Enhancements (app_mobile_v2.css)
   RA Design System 2.3 - 移动端专属交互专项增强：
   1. Header: LOGO + 搜索图标 + 汉堡抽屉 ☰ (非 6 导航挤爆)
   2. 全屏战术搜索抽屉与沉浸式导航
   3. 资源详情页 Sticky CTA 底部悬浮条与安全防遮挡间距
   4. 攻略文章与帖子详情页深度排版自适应 (文字、表格、代码、图片)
   5. 评论区、输入框与模态弹窗针对手机端自适应微调
   ============================================================ */

/* 移动端 (<= 768px) 核心自适应重构 */
@media (max-width: 768px) {
  /* 导航精简架构 */
  .nav .wrap {
    justify-content: space-between;
    padding: 0 16px;
    height: 56px;
    gap: 12px;
  }

  /* 隐藏桌面长链接导航，转由汉堡抽屉承接 */
  .nav-links,
  .nav-cta {
    display: none !important;
  }

  /* 移动端专有工具条 */
  .mobile-nav-actions {
    display: flex !important;
    align-items: center;
    gap: 14px;
  }

  .mobile-search-trigger {
    color: var(--ink, #E9E2CC);
    display: flex;
    align-items: center;
    padding: 6px;
    background: transparent;
    border: none;
    cursor: pointer;
  }

  .mobile-menu-burger {
    color: var(--ink, #E9E2CC);
    background: var(--bg-2, #1B1F14);
    border: 1px solid var(--line, #3A4128);
    width: 36px;
    height: 36px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    border-radius: 2px;
  }

  .mobile-menu-burger span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--gold, #D9A441);
    transition: transform 0.2s;
  }

  /* 全屏侧边抽屉菜单 */
  .mobile-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .mobile-drawer-overlay.active {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-drawer-panel {
    position: fixed;
    top: 0;
    right: -280px;
    width: 260px;
    height: 100vh;
    background: #0E100A;
    border-left: 1px solid var(--line, #3A4128);
    z-index: 1000;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: -8px 0 24px rgba(0,0,0,0.6);
    transition: right 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .mobile-drawer-overlay.active .mobile-drawer-panel {
    right: 0;
  }

  .mobile-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--line, #3A4128);
    padding-bottom: 14px;
  }

  .mobile-drawer-title {
    font-size: 14px;
    color: var(--gold, #D9A441);
    font-family: var(--mono, monospace);
    letter-spacing: 1px;
  }

  .mobile-drawer-close {
    background: transparent;
    border: none;
    color: var(--muted, #9AA085);
    font-size: 20px;
    cursor: pointer;
  }

  .mobile-drawer-links {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .mobile-drawer-links a {
    color: var(--ink, #E9E2CC);
    font-size: 15px;
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 2px;
    background: rgba(27, 31, 20, 0.5);
    border: 1px solid transparent;
  }

  .mobile-drawer-links a:hover, .mobile-drawer-links a.on {
    border-color: var(--red, #D5382C);
    color: #fff;
    background: #1B1F14;
  }

  /* 资源详情页 Sticky CTA 底部悬浮条与安全防遮挡间距 */
  body.has-mobile-sticky {
    padding-bottom: 74px !important;
  }

  .ra-mobile-sticky-cta {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(14, 16, 10, 0.96);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--line, #3A4128);
    padding: 0 16px;
    align-items: center;
    justify-content: space-between;
    z-index: 100;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.6);
  }

  .ra-mobile-sticky-title {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--ink, #E9E2CC);
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ra-mobile-sticky-btn {
    background: var(--red, #D5382C);
    color: #fff !important;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    border-radius: 2px;
    border: 1px solid #FF5A4D;
    letter-spacing: 0.5px;
  }

  /* 攻略/文章/帖子正文移动端深度阅读排版 */
  .article-body, .art-body, .guide-content, .pd-body {
    font-size: 16px !important;
    line-height: 1.85 !important;
    word-break: break-word !important;
  }

  .article-body h2, .guide-content h2, .pd-body h2 {
    font-size: 20px !important;
    margin: 24px 0 12px !important;
  }

  .article-body h3, .guide-content h3, .pd-body h3 {
    font-size: 18px !important;
    margin: 18px 0 8px !important;
  }

  /* 图片与多媒体等比缩放防撑破 */
  .article-body img, .guide-content img, .pd-body img, .detail-body img {
    max-width: 100% !important;
    height: auto !important;
    border-radius: 2px;
  }

  /* 代码块防撑破并支持平滑横滑 */
  .article-body pre, .guide-content pre, .pd-body pre {
    max-width: 100%;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    padding: 10px 12px !important;
    font-size: 12px !important;
  }

  /* 数据对比表格横向滑动与视觉提示 */
  .article-body table, .guide-content table, .pd-body table, .detail-body table {
    display: block !important;
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    border-collapse: collapse;
    margin: 14px 0;
  }

  /* 评论区与输入框移动端友好化 */
  .cmt-box textarea, .comment-form textarea {
    width: 100% !important;
    box-sizing: border-box;
    font-size: 15px !important; /* 避免 iOS 聚焦自动放大 */
  }

  .cmt .who {
    font-size: 13.5px !important;
  }

  .cmt p {
    font-size: 13.5px !important;
    line-height: 1.6 !important;
  }

  .cmt.reply {
    margin-left: 18px !important;
    padding-left: 8px;
    border-left: 2px solid var(--line-soft, #262B1C);
  }

  /* 弹窗防溢出处理 */
  .modal-dialog, .res-modal-inner, #resModal > div {
    max-width: 95vw !important;
    padding: 16px !important;
  }
}

/* 桌面端隐藏移动端专属部件 */
@media (min-width: 769px) {
  .mobile-nav-actions,
  .mobile-drawer-overlay,
  .ra-mobile-sticky-cta {
    display: none !important;
  }
}

/* 移动端 (<= 768px) 标准导航 .ra-navbar 适配 */
@media (max-width: 768px) {
  .ra-navbar {
    height: 56px;
  }
  .ra-nav-inner {
    padding: 0 16px;
    height: 56px;
  }
  .ra-nav-menu,
  .ra-nav-right {
    display: none !important;
  }
  .ra-brand-logo {
    height: 34px;
  }
  .ra-brand-title {
    font-size: 16px;
  }
  .ra-brand-sub {
    display: none;
  }
}

/* 移动端 (<= 768px) 标准导航 .ra-navbar 适配 */
@media (max-width: 768px) {
  .ra-navbar {
    height: 56px;
  }
  .ra-nav-inner {
    padding: 0 16px;
    height: 56px;
  }
  .ra-nav-menu,
  .ra-nav-right {
    display: none !important;
  }
  .ra-brand-logo {
    height: 34px;
  }
  .ra-brand-title {
    font-size: 16px;
  }
  .ra-brand-sub {
    display: none;
  }
}
