/* =========================================================================
   红河资源下载站 · 独立移动端 UI（≤1024px）
   与桌面端分离的信息架构；桌面样式见 styles.css
   ========================================================================= */

@media (max-width: 1024px) {
  html {
    -webkit-text-size-adjust: 100%;
  }

  body.hh-mobile-site {
    overflow-x: hidden;
    padding-bottom: calc(62px + env(safe-area-inset-bottom));
  }

  body.hh-mobile-site .app-wrapper {
    padding-left: 12px;
    padding-right: 12px;
    max-width: none;
  }

  /* ---------- 顶栏精简：隐藏桌面 Tab，保留品牌 + 登录 ---------- */
  body.hh-mobile-site .tabs-nav {
    display: none !important;
  }

  body.hh-mobile-site .app-header,
  body.hh-mobile-site site-header .app-header {
    display: none !important;
  }

  body.hh-mobile-site .top-navbar {
    margin: 0 -12px;
  }

  body.hh-mobile-site .top-navbar-inner {
    height: 48px;
    padding: 0 12px;
    gap: 8px;
  }

  body.hh-mobile-site .nav-brand-text {
    display: inline;
    font-size: 13px;
    max-width: 9em;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  body.hh-mobile-site .nav-brand-mark {
    height: 26px;
  }

  body.hh-mobile-site .nav-login-btn {
    min-height: 36px;
    padding: 0 14px;
    font-size: 12px;
  }

  body.hh-mobile-site .nav-user-chip {
    min-height: 36px;
    width: 36px;
    padding: 0 4px;
  }

  body.hh-mobile-site .nav-user-id {
    display: none;
  }

  body.hh-mobile-site .theme-toggle {
    min-width: 36px;
    width: 36px;
    height: 36px;
    padding: 0;
    margin-right: 0;
  }

  body.hh-mobile-site .theme-toggle-text {
    display: none;
  }

  body.hh-mobile-site .hh-home-secondary {
    margin: 1rem auto 1.5rem;
    padding-top: 1rem;
  }

  body.hh-mobile-site .hh-home-secondary-head {
    display: block;
    margin-bottom: 10px;
  }

  body.hh-mobile-site .hh-home-tool-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  body.hh-mobile-site .hh-home-tool {
    min-height: 68px;
    padding: 10px;
  }

  body.hh-mobile-site .hh-home-tool-icon {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  body.hh-mobile-site .nav-search-btn {
    min-width: 36px;
    width: 36px;
    height: 36px;
    padding: 0;
    justify-content: center;
  }

  body.hh-mobile-site .nav-search-text {
    display: none;
  }

  /* 全站搜索 / 上新日历浮层 */
  .hh-search-overlay,
  .hh-wn-overlay {
    padding: 12px;
    align-items: stretch;
  }

  .hh-search-panel,
  .hh-wn-panel {
    max-height: none;
    width: 100%;
  }

  .hh-search-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hh-wn-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* ---------- 底部站点 Dock ---------- */
  .hh-mobile-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 500;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: rgba(9, 13, 19, 0.96);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
  }

  .hh-dock-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 50px;
    padding: 4px 2px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-faint);
    -webkit-tap-highlight-color: transparent;
    transition: background var(--transition), color var(--transition);
  }

  .hh-dock-ico {
    font-size: 16px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 18px;
  }

  .hh-dock-lbl {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.02em;
  }

  @media (max-width: 380px) {
    .hh-dock-lbl {
      font-size: 9px;
      letter-spacing: 0;
    }
    .hh-dock-tab {
      padding: 4px 0;
    }
  }

  .hh-dock-tab.is-active {
    color: var(--accent);
    background: var(--accent-dim);
    box-shadow: 0 0 0 1px rgba(0, 229, 255, 0.2) inset;
  }

  .hh-dock-tab:active {
    transform: scale(0.97);
  }

  /* ---------- 图标页：独立移动布局 ---------- */
  body.hh-mobile-site .main-content {
    flex-direction: column;
    gap: 0;
  }

  /* 分类走「展开分类」折叠面板（原站交互），不再用横向胶囊条 */
  body.hh-mobile-site .mc-mobile-toggle {
    display: block !important;
    min-height: 44px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 700;
  }

  body.hh-mobile-site .sidebar {
    display: none !important;
  }

  body.hh-mobile-site .sidebar.sidebar-open {
    display: flex !important;
    position: static;
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 8px 0 12px;
    margin-bottom: 8px;
  }

  body.hh-mobile-site .sidebar .mc-sidebar-item {
    min-height: 44px;
  }

  body.hh-mobile-site .content-area {
    padding-left: 0;
    width: 100%;
  }

  .hh-m-sticky-tools {
    position: sticky;
    top: 48px;
    z-index: 40;
    margin: 0 -12px;
    padding: 10px 12px 8px;
    background: linear-gradient(180deg, rgba(11, 15, 21, 0.98) 70%, rgba(11, 15, 21, 0));
    backdrop-filter: blur(8px);
  }

  body.hh-mobile-site .mc-search-input {
    min-height: 48px;
    font-size: 16px;
  }

  body.hh-mobile-site .mc-sort-row {
    margin-top: 10px;
    flex-wrap: wrap;
    gap: 8px;
  }

  body.hh-mobile-site .gs-sort-tabs {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  body.hh-mobile-site .gs-sort-tab {
    min-height: 40px;
    justify-content: center;
  }

  body.hh-mobile-site .mc-sort-hint {
    width: 100%;
    font-size: 11px;
  }

  body.hh-mobile-site .subcategory-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
    padding-bottom: 4px;
    margin-bottom: 10px;
  }

  body.hh-mobile-site .subcat-tab {
    flex-shrink: 0;
    min-height: 36px;
    white-space: nowrap;
  }

  body.hh-mobile-site .mc-icons-grid.mc-grid-standard {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }

  body.hh-mobile-site .mc-icon-item {
    min-height: 72px;
    border-radius: var(--radius-sm);
  }

  body.hh-mobile-site .mc-pagination {
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    padding-bottom: 8px;
  }

  body.hh-mobile-site .mc-page-button {
    min-width: 40px;
    min-height: 40px;
  }

  body.hh-mobile-site .hh-announcement {
    margin-bottom: 0.75rem;
    border-radius: var(--radius);
    font-size: 12px;
    padding: 8px 12px;
    max-width: none;
  }

  /* ---------- 弹窗：全屏抽屉 ---------- */
  body.hh-mobile-site .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  body.hh-mobile-site .modal-content {
    width: 100%;
    max-width: none;
    max-height: 92dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
    animation: hhSheetUp 0.24s ease;
  }

  body.hh-mobile-site .modal-action-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  body.hh-mobile-site .modal-download {
    grid-column: 1 / -1;
    min-height: 48px;
  }

  body.hh-mobile-site .enchant-action-btn,
  body.hh-mobile-site .greenscreen-action-btn,
  body.hh-mobile-site .modal-fav-btn {
    min-height: 44px;
  }

  body.hh-mobile-site .modal-preview {
    min-height: 160px;
  }

  body.hh-mobile-site .enchant-modal-overlay {
    align-items: flex-end;
  }

  body.hh-mobile-site .enchant-modal {
    width: 100%;
    max-width: none;
    max-height: 94dvh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  /* ---------- 绿幕库页 ---------- */
  body.hh-mobile-site .gs-topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 12px;
  }

  body.hh-mobile-site .gs-count {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
  }

  body.hh-mobile-site .gs-credit-card {
    margin-left: 0;
    width: 100%;
    justify-content: space-between;
  }

  body.hh-mobile-site .gs-admin-area {
    flex-wrap: wrap;
    width: 100%;
  }

  body.hh-mobile-site .gs-sort-tabs {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  body.hh-mobile-site .gs-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  body.hh-mobile-site .gs-card-info {
    padding: 10px;
  }

  body.hh-mobile-site .gs-preview-modal {
    width: 100%;
    max-width: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  body.hh-mobile-site .gs-modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  body.hh-mobile-site .gs-modal {
    width: 100%;
    max-width: none;
    max-height: 92dvh;
    overflow-y: auto;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }

  body.hh-mobile-site .gs-preview-download {
    min-height: 48px;
  }

  /* ---------- 贴图页 ---------- */
  body.hh-mobile-site .textures-main {
    flex-direction: column;
    gap: 12px;
  }

  body.hh-mobile-site .textures-left-panel {
    width: 100%;
    min-width: 0;
    max-height: min(42dvh, 360px);
    order: 2;
  }

  body.hh-mobile-site .textures-right-panel {
    order: 1;
    min-height: 240px;
  }

  body.hh-mobile-site .textures-source-tab {
    min-height: 44px;
  }

  body.hh-mobile-site .textures-search-input {
    min-height: 44px;
    font-size: 16px;
  }

  body.hh-mobile-site .textures-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  body.hh-mobile-site .texture-settings-row {
    flex-direction: column;
    gap: 12px;
  }

  body.hh-mobile-site .download-btn {
    min-height: 48px;
    width: 100%;
  }

  /* ---------- 皮肤页 ---------- */
  body.hh-mobile-site .skins-input-row {
    flex-direction: column;
    gap: 8px;
    margin-bottom: 1rem;
  }

  body.hh-mobile-site .skins-username-input {
    border-radius: var(--radius);
    border-right: 1px solid var(--border);
    min-height: 48px;
    font-size: 16px;
  }

  body.hh-mobile-site .skins-fetch-btn {
    width: 100%;
    border-radius: var(--radius);
    min-height: 48px;
  }

  body.hh-mobile-site .skins-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  body.hh-mobile-site .vault-skins-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  body.hh-mobile-site .vault-live3d {
    height: min(52dvh, 340px);
  }

  body.hh-mobile-site .trending-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  body.hh-mobile-site .trending-actions {
    justify-content: flex-start;
  }

  body.hh-mobile-site .trending-refresh-btn,
  body.hh-mobile-site .trending-page-btn {
    min-height: 40px;
  }

  /* ---------- 3D 文字页 ---------- */
  body.hh-mobile-site .t3d-layout {
    flex-direction: column;
    height: auto;
    min-height: calc(100dvh - 48px - 62px);
  }

  body.hh-mobile-site .t3d-panel {
    width: 100%;
    min-width: 0;
    max-height: min(46dvh, 380px);
    border-right: 0;
    border-bottom: 2px solid #2b2b2b;
  }

  body.hh-mobile-site .t3d-canvas-wrap {
    min-height: min(48dvh, 360px);
    flex: 1;
  }

  body.hh-mobile-site .t3d-toolbar {
    top: auto;
    bottom: 12px;
    right: 12px;
    left: 12px;
    justify-content: center;
  }

  body.hh-mobile-site .t3d-toolbar-btn {
    min-height: 40px;
    flex: 1;
  }

  /* ---------- 登录弹窗 ---------- */
  body.hh-mobile-site .hh-modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  body.hh-mobile-site .hh-modal {
    width: 100%;
    max-width: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }

  body.hh-mobile-site .hh-btn-primary {
    min-height: 48px;
  }

  body.hh-mobile-site .hh-field input {
    min-height: 44px;
    font-size: 16px;
  }

  body.hh-mobile-site .site-footer {
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 640px) {
  body.hh-mobile-site .mc-icons-grid.mc-grid-standard {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body.hh-mobile-site .gs-grid {
    grid-template-columns: 1fr;
  }

  body.hh-mobile-site .textures-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@keyframes hhSheetUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1024px) and (prefers-reduced-motion: reduce) {
  body.hh-mobile-site .modal-content {
    animation: none;
  }
}

/* 白天主题移动 Dock */
html[data-theme="day"] body.hh-mobile-site .hh-mobile-dock {
  background: rgba(244, 238, 202, 0.96);
  border-top-color: #8cc45e;
}

html[data-theme="day"] body.hh-mobile-site .hh-dock-tab.is-active {
  color: #00647d;
  background: rgba(0, 100, 125, 0.12);
}

html[data-theme="day"] body.hh-mobile-site .hh-m-sticky-tools {
  background: linear-gradient(180deg, rgba(244, 238, 202, 0.98) 70%, rgba(244, 238, 202, 0));
}

/* ==================== 微信/QQ 内置浏览器提示条 ==================== */
.hh-inapp-banner {
  position: sticky;
  top: 0;
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  padding-top: max(9px, env(safe-area-inset-top));
  background: linear-gradient(90deg, rgba(255, 207, 92, 0.16), rgba(255, 160, 60, 0.12));
  border-bottom: 1px solid rgba(255, 207, 92, 0.4);
  color: var(--text-dim, #a8b3c2);
  font-size: 12.5px;
  line-height: 1.5;
}
.hh-inapp-banner b {
  color: #ffcf5c;
}
.hh-inapp-banner button {
  flex-shrink: 0;
  background: none;
  border: none;
  color: inherit;
  font-size: 18px;
  line-height: 1;
  padding: 6px 8px;
  cursor: pointer;
}

/* 下载引导全屏浮层（指向右上角 ···） */
.hh-inapp-guide {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(4, 8, 14, 0.82);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.hh-inapp-guide-arrow {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  right: 18px;
  font-size: 44px;
  color: #ffcf5c;
  animation: hhBounce 1s ease infinite;
}
@keyframes hhBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.hh-inapp-guide-box {
  max-width: 320px;
  background: var(--panel, #151b24);
  border: 1px solid var(--border-strong, #394556);
  border-radius: 14px;
  padding: 22px 20px;
  text-align: center;
}
.hh-inapp-guide-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text, #e6ebf2);
  margin-bottom: 10px;
}
.hh-inapp-guide-text {
  font-size: 13.5px;
  color: var(--text-dim, #a8b3c2);
  line-height: 1.8;
  margin-bottom: 16px;
}
.hh-inapp-guide-text b {
  color: #ffcf5c;
}
.hh-inapp-guide-btn {
  width: 100%;
  min-height: 46px;
  border: none;
  border-radius: 10px;
  background: var(--accent, #00e5ff);
  color: #03252e;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

/* ==================== 下载反馈 toast ==================== */
.hh-dl-toast {
  position: fixed;
  left: 50%;
  bottom: calc(76px + env(safe-area-inset-bottom));
  transform: translate(-50%, 16px);
  z-index: 2500;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  background: rgba(9, 13, 19, 0.95);
  border: 1px solid var(--border-strong, #394556);
  border-radius: 999px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  color: var(--text, #e6ebf2);
  font-size: 13px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.hh-dl-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}
.hh-dl-toast-ico {
  color: var(--accent, #00e5ff);
  font-weight: 700;
}
.hh-dl-toast a {
  color: var(--accent, #00e5ff);
  text-decoration: none;
  font-weight: 700;
}
html[data-theme="day"] .hh-dl-toast {
  background: rgba(250, 244, 214, 0.97);
  color: #203846;
  border-color: #9fcf70;
}
html[data-theme="day"] .hh-inapp-guide-box {
  background: rgba(250, 244, 214, 0.98);
}
html[data-theme="day"] .hh-inapp-guide-title {
  color: #203846;
}
html[data-theme="day"] .hh-inapp-guide-text {
  color: #3d5664;
}
