/* ============================================================
   爱冒险玖日 · 手机端统一响应式增强
   不拆分页面：桌面版功能全部保留，仅在小屏重排/触屏优化。
   ============================================================ */

/* ---------- 全局触屏友好 ---------- */
@media (max-width: 760px) {
  html { -webkit-text-size-adjust: 100%; }
  body { overflow-x: hidden; }

  /* 按钮/链接更容易点 */
  .btn, button { min-height: 42px; }
  .btn-mini { min-height: 34px; }

  /* 输入框触屏缩放避免被浏览器放大 */
  input, select, textarea { font-size: 16px !important; }

  /* 模态框占满更多空间，便于触屏操作 */
  .modal-panel { width: min(94vw, 100%) !important; max-height: 92vh !important; padding: 20px !important; }
  .modal-close { right: 14px; top: 14px; }

  /* 隐藏横向滚动造成的页面跳动 */
  .table-wrap { -webkit-overflow-scrolling: touch; }
}

/* 桌面端默认隐藏手机菜单按钮 */
.nav-menu-btn { display: none; }

/* ---------- 首页导航 ---------- */
@media (max-width: 720px) {
  .nav-inner { position: relative; gap: 10px; }
  .nav-menu-btn { display: inline-flex; flex-direction: column; gap: 4px; background: rgba(255,255,255,0.04); border: 1px solid var(--line); border-radius: 9px; padding: 8px; margin-left: auto; }
  .nav-menu-btn span { display: block; width: 18px; height: 2px; background: var(--txt); border-radius: 2px; }
  .nav-links { position: absolute; top: 62px; right: 0; left: 0; display: none; flex-direction: column; gap: 0; background: rgba(10,10,12,0.98); border: 1px solid var(--line); border-radius: 14px; padding: 8px; z-index: 200; }
  body.nav-open .nav-links { display: flex; }
  .nav-links a { padding: 12px 14px; border-radius: 10px; }
  .nav-links a:active { background: rgba(255,255,255,0.06); }
  .nav-actions { margin-left: 0; }
  .nav-actions .btn-primary { display: none; }
  .nav-actions .user-btn { font-size: 13px; padding: 8px 12px; }
  .brand-name { font-size: 15px; }
  .brand-mark { width: 32px; height: 32px; }

  /* 首页 hero 文本和间距 */
  .hero { min-height: 78vh; padding-top: 96px; }
  .hero-title { font-size: clamp(40px, 13vw, 68px); }
  .hero-sub { font-size: 15px; }
  .hero-cta { flex-direction: column; align-items: stretch; gap: 12px; }
  .hero-cta .btn { width: 100%; }

  /* 游戏区域和关于区域 */
  .games-toolbar { flex-direction: column; align-items: stretch; }
  .games-searchbox { max-width: 100%; }
  .games-search { width: 100%; }
  .section-actions { width: 100%; justify-content: space-between; }
  .about-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .contact-title { font-size: 30px; }

  /* 首页游戏卡片/轮播 */
  .carousel { gap: 12px; }
  .game-card { min-width: 82vw; }
}

/* 通用：商店 / AI 工坊手机菜单 */
@media (max-width: 760px) {
  .store-nav-inner, .studio-nav-inner { position: relative; }
  .nav-menu-btn { display: inline-flex; margin-left: auto; }
  .store-links, .studio-links { position: absolute; top: 62px; right: 0; left: 0; display: none; flex-direction: column; gap: 0; background: rgba(10,10,12,0.98); border: 1px solid var(--line); border-radius: 14px; padding: 8px; z-index: 200; }
  body.nav-open .store-links, body.nav-open .studio-links { display: flex; }
  .store-links a, .studio-links a { padding: 12px 14px; border-radius: 10px; }
  .store-links a:active, .studio-links a:active { background: rgba(255,255,255,0.06); }
}

/* ---------- 商店 ---------- *//* ---------- 商店 ---------- */
@media (max-width: 760px) {
  .store-nav-inner { gap: 10px; height: 62px; }
  .store-links { display: none; }
  .store-toolbar { flex-direction: column; align-items: stretch; gap: 12px; }
  .store-sort { margin-left: 0; justify-content: space-between; overflow-x: auto; padding-bottom: 2px; }
  .store-sort .sort-btn { flex: 1 1 auto; }
  .store-searchbox { max-width: 100%; }
  .store-search { width: 100%; }
  .featured { aspect-ratio: 16 / 11; border-radius: 16px; }
  .feat-info { left: 18px; right: 18px; bottom: 18px; max-width: none; }
  .feat-title { font-size: 24px; margin: 8px 0 6px; }
  .feat-desc { font-size: 13px; -webkit-line-clamp: 2; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
  .feat-tags { margin: 8px 0 10px; }
  .featured-lbl { top: 14px; left: 14px; font-size: 10px; }
  .store-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .store-card-title { font-size: 14px; }
  .store-card-body { padding: 10px 11px 12px; }
  .store-card-tags span { font-size: 9px; }
  .store-price, .store-like { font-size: 11px; }
}

/* 手机横屏/中等窄屏卡片 */
@media (max-width: 480px) {
  .store-grid { grid-template-columns: 1fr; gap: 14px; }
}

/* ---------- AI 工坊 ---------- */
@media (max-width: 860px) {
  .studio-nav-inner { gap: 10px; height: 62px; }
  .studio-links { display: none; }
  .studio { padding: 20px 12px 70px; }
  .studio-grid { grid-template-columns: 1fr; gap: 16px; }
  .studio-gate { padding: 28px 16px; }
  .studio-gate-actions { flex-direction: column; }
  .studio-gate-actions .btn { width: 100%; }

  /* 预览和输入面板尽量全宽 */
  .studio-frame, .studio-thumb { aspect-ratio: 16 / 9; }
  .gen-progress-text { line-height: 1.5; }

  /* AI 工坊工具面板 */
  .pro-topbar, .pro-genbar-head, .pro-result-head { flex-direction: column; align-items: stretch; }
  .pro-layout { grid-template-columns: 1fr; }
  .pro-canvas { min-height: 360px; }
  .pro-genbar-row { grid-template-columns: 1fr; }
  .pro-topbar-actions, .pro-result-actions { width: 100%; flex-wrap: wrap; }
  .pro-topbar-actions .btn, .pro-result-actions .btn { flex: 1 1 auto; }
}

/* 手机更小屏的 AI 工坊细节 */
@media (max-width: 520px) {
  .studio-gate h1 { font-size: 24px; }
  .studio-gate p { font-size: 14px; }
  .model-grid, #studioModelsList, #studioMaterialsList { grid-template-columns: 1fr 1fr; gap: 8px; }
  .model-pick-list, .model-cats, .lib-tools { flex-direction: column; align-items: stretch; }
  .lib-modal-scroll { padding: 18px; }
  .pro-title, .pro-project { width: 100%; }
}

/* ---------- 开发者中心 / 管理后台 ---------- */
@media (max-width: 760px) {
  .topbar { height: 60px; padding: 0 12px; gap: 8px; }
  .topbar-title { font-size: 13px; }
  .topbar-right { gap: 6px; }
  .topbar-right .btn { padding: 7px 9px; font-size: 12px; }
  .content { padding: 20px 12px 70px; }
  .content-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .content-head .btn { width: 100%; }
  .card { border-radius: 14px; margin-bottom: 16px; }
  .card-head { padding: 14px 15px; gap: 10px; }
  .card-head h2 { font-size: 16px; }
  .card-head .btn-mini { margin-left: auto; }

  /* 表格改成可横向滑动，保留所有列 */
  .table-wrap { margin: 0 -1px; }
  .table th, .table td { padding: 11px 10px; font-size: 13px; white-space: nowrap; }
  .cover-thumb { width: 52px; height: 34px; }

  /* 表单和封面 */
  .cover-row { flex-direction: column; align-items: stretch; }
  .cover-preview { width: 100%; height: 160px; }
  .cover-controls { min-width: 0; }
  .security-form, .settings-grid, .stats-grid, .stats-kpis, .charts { grid-template-columns: 1fr; }

  /* 登录门 */
  .gate-panel { padding: 24px 18px; }
  .gate-title { font-size: 22px; }
}

/* 开发者中心更小屏 */
@media (max-width: 480px) {
  .apply-card { margin: 16px 0; }
  .topbar-right .btn-sm { display: none; }
  .topbar-right #logoutBtn { display: inline-flex; }
  .table th, .table td { font-size: 12px; }
  .row-actions { flex-wrap: wrap; gap: 6px; }
}

/* ---------- 个人主页 / 用户中心 ---------- */
@media (max-width: 760px) {
  .profile { padding: 22px 12px 70px; }
  .profile-head { flex-direction: column; align-items: center; text-align: center; gap: 16px; }
  .profile-info { min-width: 0; }
  .profile-name { font-size: 26px; }
  .profile-actions { justify-content: center; }
  .games-grid { grid-template-columns: 1fr; gap: 16px; }
}

/* ---------- 充值页 ---------- */
@media (max-width: 820px) {
  .rc-grid { grid-template-columns: 1fr; gap: 16px; }
  .member-tiers { grid-template-columns: 1fr; }
}

/* ---------- 工具页 / 本地工具 ---------- */
@media (max-width: 760px) {
  .wrap { padding: 12px; gap: 12px; }
  .col { min-width: 0; flex-basis: 100%; padding: 14px; }
  .row { flex-direction: column; align-items: stretch; }
  .row > * { min-width: 0; }
  #preview { max-width: 100%; }
  .lib-tools { grid-template-columns: 1fr; }
  .pro-node-body { padding: 10px; }
}
