/* Responsive layout and component adaptations. */

@media (min-width: 900px) {
  .desktop-nav { display: flex; }
  .menu-toggle,
  .side-menu,
  .menu-overlay { display: none; }
}

@media (max-width: 1280px) {
  .game-shell {
    transform: scale(0.96);
    transform-origin: center;
  }

  .minesweeper { transform: none; }
}

@media (max-width: 1100px) {
  .game-shell {
    transform: scale(0.92);
    transform-origin: center;
  }

  .minesweeper { transform: none; }
  .products-grid,
  .catalog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1000px) {
  .checkout-layout { grid-template-columns: 1fr; }

  .checkout-summary {
    border-left: 0;
    border-top: 1px solid #dddddd;
    order: -1;
  }

  .checkout-summary-inner { position: static; }
}

@media (max-width: 900px) {
  .page-layout {
    height: auto;
    min-height: 100vh;
    overflow: visible;
    grid-template-columns: 1fr;
    grid-template-rows: 72px auto auto;
    grid-template-areas:
      "header"
      "game"
      "products";
  }

  .game-section {
    padding: 10%;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    min-height: auto;
  }

  .minesweeper {
    max-width: 400px;
    transform: none;
  }

  .game-shell {
    padding-bottom: 54px;
    transform: none;
  }

  .game-tool-button {
    width: 46px;
    height: 46px;
  }

  .products-section {
    padding: 0;
    overflow: visible;
  }

  .products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .product-gallery { -webkit-overflow-scrolling: touch; }

  .mine-action-menu {
    position: fixed;
    z-index: 90;
    display: flex;
    gap: 8px;
    padding: 5px;
    border-radius: 999px;
    background: rgba(20, 20, 28, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.28);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(6px);
  }

  .mine-action-menu button {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 2px solid rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    background: var(--ms-mid);
    color: var(--text-dark);
    font-size: 25px;
    line-height: 1;
    cursor: pointer;
  }

  .mine-action-menu .mine-action-flag {
    color: #ff4f5e;
  }

  .mine-action-menu .mine-action-reveal {
    color: #7c3cff;
  }

  .mine-action-menu button:active {
    background: #7c3cff;
    color: #ffffff;
    transform: scale(0.92);
  }
}

@media (max-width: 775px) {
  .product-detail {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 72px 0 0;
  }

  .product-detail-gallery {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    max-width: 100%;
    max-height: none;
  }

  .gallery-thumbs {
    flex-direction: row;
    order: 2;
    overflow-x: auto;
    padding: 8px 0;
  }

  .thumb {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
  }

  .gallery-main {
    order: 1;
    max-height: none;
  }

  .product-info {
    padding: 20px 16px 24px;
    gap: 14px;
    min-height: auto;
    height: auto;
  }

  .product-info .product-title { font-size: 22px; }
  .product-info .product-price { font-size: 18px; }
  .product-actions .btn { padding: 14px; }
  .recommended { padding: 0 16px 32px; }

  .recommended-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}

@media (max-width: 700px) {
  .products-footer-inner {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .footer-copy { text-align: center; }

  .checkout-header-inner,
  .checkout-main,
  .checkout-summary-inner {
    padding-left: 16px;
    padding-right: 16px;
  }

  .checkout-header-inner {
    min-height: 64px;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .checkout-brand { font-size: 22px; }

  .checkout-breadcrumb {
    font-size: 12px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .form-grid.two-cols { grid-template-columns: 1fr; }

  .checkout-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .checkout-submit {
    width: 100%;
    min-width: 0;
  }

  .summary-discount { grid-template-columns: 1fr; }

  .summary-row-total span,
  .summary-row-total strong { font-size: 20px; }

  .payment-brands { justify-content: flex-start; }
  .payment-panel { padding: 14px; }

  .tutorial-panel {
    padding: 18px;
  }

  .customizer-panel {
    width: min(92vw, 620px);
    padding: 18px;
  }

  .preview-panel {
    grid-template-columns: 58px 42px 58px;
    gap: 10px;
  }

  .preview-board {
    grid-template-columns: repeat(3, min(42px, 14vw));
    grid-auto-rows: min(42px, 14vw);
  }

  .tutorial-steps li {
    grid-template-columns: 34px 1fr;
    padding: 12px;
  }

  .tutorial-step-number {
    width: 32px;
    height: 32px;
  }

  .tutorial-board {
    --tutorial-cell: min(42px, 14vw);
  }
}

@media (max-width: 640px) {
  .catalog-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .lock-message strong { font-size: 28px; }
}
