/*
 * GameHub 移动端适配样式
 * 注入所有游戏页面，解决三列布局在手机无法使用的问题
 * 断点：<= 768px 切换为移动布局
 */

/* ─── 导航栏移动端 ─── */
@media (max-width: 768px) {
  .nav {
    padding: 12px 16px;
    flex-wrap: nowrap;
    gap: 8px;
  }
  .nav-logo {
    font-size: 15px;
    flex-shrink: 0;
  }
  .nav-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-shrink: 1;
    min-width: 0;
  }
  .nav-tabs::-webkit-scrollbar { display: none; }
  .nav-tab {
    padding: 6px 10px;
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .nav-badge { display: none; }
}

/* ─── 三列变单列（核心）─── */
@media (max-width: 768px) {
  .main {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    min-height: calc(100vh - 57px);
  }

  /* 左侧配置：折叠为抽屉 */
  .panel-left {
    border-right: none !important;
    border-bottom: 1px solid var(--border);
    padding: 16px !important;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }
  .panel-left.expanded {
    max-height: 600px;
    overflow-y: auto;
  }

  /* 中间游戏区 */
  .game-center {
    padding: 16px !important;
    order: -1; /* 游戏区置顶 */
    min-height: 55vh;
  }

  /* 右侧数据：折叠 */
  .panel-right {
    border-left: none !important;
    border-top: 1px solid var(--border);
    padding: 16px !important;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }
  .panel-right.expanded {
    max-height: 500px;
    overflow-y: auto;
  }

  /* 移动端底部标签栏 */
  .mobile-tabs {
    display: flex !important;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 200;
    background: rgba(13,7,32,0.97);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(12px);
  }
  .mobile-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 4px;
    font-size: 10px;
    color: var(--muted);
    cursor: pointer;
    transition: color 0.2s;
    gap: 3px;
    border: none;
    background: transparent;
  }
  .mobile-tab.active { color: var(--gold); }
  .mobile-tab-icon { font-size: 18px; line-height: 1; }

  /* 底部留出标签栏空间 */
  body { padding-bottom: 56px; }
}

/* ─── 游戏画布适配 ─── */
@media (max-width: 768px) {
  /* Canvas游戏：限制最大宽高 */
  canvas {
    max-width: 100% !important;
    max-height: 60vw !important;
    height: auto !important;
  }

  /* 大转盘 */
  .wheel-container {
    width: min(300px, 80vw) !important;
    height: min(300px, 80vw) !important;
  }
  #wheelCanvas {
    width: min(300px, 80vw) !important;
    height: min(300px, 80vw) !important;
  }

  /* 游戏标题 */
  .game-name { font-size: 20px !important; }
  .game-subtitle { font-size: 12px !important; }

  /* 按钮 */
  .btn, button[class*="btn"] {
    min-height: 44px; /* 触控最小点击区 */
    padding: 10px 20px;
    font-size: 14px;
  }
}

/* ─── 底部状态栏移动端 ─── */
@media (max-width: 768px) {
  .footer-bar {
    font-size: 10px;
    padding: 6px 12px;
    text-align: center;
  }
}

/* ─── 默认隐藏移动端标签栏（桌面端不显示）─── */
.mobile-tabs { display: none; }

/* ─── 小屏幕卡片/配置 ─── */
@media (max-width: 768px) {
  .card { padding: 12px !important; margin-bottom: 10px !important; }
  .card-title { font-size: 13px !important; }
  .rule-row { font-size: 12px !important; }
  .panel-title { font-size: 11px !important; }
}

/* ─── index.html 首页适配 ─── */
@media (max-width: 768px) {
  .hero { padding: 32px 16px 24px; }
  .hero-title { font-size: 32px !important; }
  .hero-desc { font-size: 13px; }
  .hero-stats { gap: 16px; flex-wrap: wrap; justify-content: center; }
  .hero-stat-num { font-size: 28px !important; }

  .games-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    padding: 0 16px !important;
  }

  .section { padding: 24px 0 !important; }
  .section-header { padding: 0 16px 16px !important; }

  .nav { padding: 12px 16px !important; }
  .nav-right { display: none; }
}
