/* 本套图小游戏移动端统一样式 */
@media (max-width: 768px) {
  /* 公共页面容器 */
  .puzzle-page,
  .memory-page,
  .guess-page,
  .fx-page {
    padding: 1rem 0.75rem;
    box-sizing: border-box;
    width: 100%;
    overflow-x: hidden;
  }

  /* 标题 */
  .puzzle-title,
  .memory-title,
  .guess-title,
  .fx-title {
    font-size: 1.35rem;
    line-height: 1.3;
    margin-bottom: 0.25rem;
  }

  .puzzle-subtitle,
  .memory-subtitle,
  .guess-subtitle,
  .fx-subtitle {
    font-size: 0.85rem;
    margin-bottom: 1rem;
    padding: 0 0.5rem;
  }

  /* 通用按钮 */
  .puzzle-btn,
  .memory-btn,
  .guess-btn,
  .fx-btn {
    width: 100%;
    box-sizing: border-box;
    padding: 0.7rem 0.75rem;
    font-size: 0.9rem;
    min-height: 44px;
  }

  /* 拼图游戏 */
  .puzzle-level {
    font-size: 1rem;
    margin-bottom: 0.75rem;
  }

  .puzzle-container {
    flex-direction: column;
    gap: 0.75rem;
    max-width: 100%;
  }

  .puzzle-preview {
    max-width: 160px;
    padding: 0.5rem;
    margin: 0 auto;
  }

  #puzzleBoard {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .puzzle-actions {
    flex-direction: column;
    width: 100%;
    gap: 0.5rem;
    margin-bottom: 1rem;
  }

  .puzzle-levels {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    padding: 0.75rem;
    max-width: 100%;
  }

  .puzzle-level-btn {
    padding: 0.55rem 0.25rem;
    font-size: 0.75rem;
    white-space: normal;
    min-height: 40px;
  }

  /* 记忆翻牌 */
  .memory-toolbar {
    flex-direction: column;
    width: 100%;
    gap: 0.5rem;
    margin-bottom: 1rem;
  }

  .memory-stat,
  .memory-toolbar .memory-btn,
  .memory-toolbar a.memory-btn {
    width: 100%;
    box-sizing: border-box;
    text-align: center;
  }

  .memory-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
    max-width: 100%;
  }

  .memory-card {
    aspect-ratio: 3/4;
  }

  .memory-card-front {
    font-size: 1rem;
  }

  .memory-finish-box {
    max-width: 90%;
    padding: 1.5rem 1rem;
  }

  /* 模糊竞猜 */
  .guess-stage {
    width: 100%;
    max-width: 100%;
    margin-bottom: 1rem;
  }

  .guess-toolbar {
    width: 100%;
    max-width: 100%;
    gap: 0.5rem;
    margin-bottom: 1rem;
  }

  .guess-slider-wrap {
    padding: 0.6rem;
    gap: 0.5rem;
  }

  .guess-actions {
    flex-direction: column;
    gap: 0.5rem;
  }

  .guess-tip {
    font-size: 0.8rem;
  }

  /* 图片特效 & 图片处理 公共 */
  .fx-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 100%;
  }

  .fx-panel {
    order: 1;
    width: 100%;
    box-sizing: border-box;
    padding: 0.75rem;
  }

  .fx-canvas-wrap {
    order: 0;
  }

  .fx-canvas-wrap {
    width: 100%;
    box-sizing: border-box;
    padding: 0.75rem;
  }

  .fx-canvas-box {
    height: auto;
    min-height: 300px;
    max-height: 55vh;
    justify-content: center;
    align-items: center;
    width: 100%;
  }

  .fx-canvas-box img,
  .fx-canvas-box canvas {
    max-width: 100%;
    max-height: 55vh;
    display: block;
    margin: 0 auto;
  }

  .fx-gallery {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0.25rem 0.25rem 0.5rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }

  .fx-gallery::-webkit-scrollbar {
    height: 6px;
  }

  .fx-gallery::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
  }

  .fx-gallery::-webkit-scrollbar-thumb {
    background: rgba(96, 165, 250, 0.6);
    border-radius: 3px;
  }

  .fx-thumb {
    width: 70px;
    height: 70px;
    flex: 0 0 70px;
    aspect-ratio: auto;
    scroll-snap-align: start;
  }

  .fx-gallery-header {
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.8rem;
  }

  .fx-thumb-check {
    width: 0.9rem;
    height: 0.9rem;
    top: 0.1rem;
    right: 0.1rem;
  }

  .fx-presets {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.4rem;
  }

  .fx-preset {
    padding: 0.5rem;
    font-size: 0.75rem;
    min-height: 40px;
  }

  .fx-btns {
    flex-direction: column;
    gap: 0.5rem;
  }

  .fx-row {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .fx-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0.25rem;
  }

  .fx-tab {
    flex: 0 0 auto;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
  }

  .fx-group {
    margin-bottom: 0.75rem;
  }

  .fx-group label {
    font-size: 0.8rem;
  }

  .fx-group select,
  .fx-group input[type="number"],
  .fx-group input[type="range"] {
    min-height: 36px;
    font-size: 0.85rem;
  }

  .fx-back {
    display: inline-block;
    margin-bottom: 0.75rem;
  }

  .progress-meta,
  .batch-fail,
  .fx-tip {
    font-size: 0.75rem;
  }
}

@media (max-width: 480px) {
  .memory-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
