@media (max-width: 480px) {
    .quantity-selector {
        font-size: 0.9rem;
        padding: 4px 10px;
        left: 0;
        width: 100%;
        box-sizing: border-box;
        justify-content: flex-start;
    }

    .quantity-selector select {
        min-width: 40px;
        padding: 4px 6px;
        font-size: 0.9rem;
    }
}

@media (max-width: 767px) {
  body {
    font-size: 0.875rem;
    line-height: 1.4;
    font-family: Arial, sans-serif;
  }

    #product-popup {
        width: 75vw;
        max-width: 375px;
        max-height: 75vh;
        padding: 25px 20px 25px;
        box-sizing: border-box;
        overflow-y: auto;
        overflow-x: hidden;
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
      }

    .popup-content {
      width: 100%;
      flex: 1 1 auto;
      display: flex;
      flex-direction: column;
      align-items: center;
      overflow-y: auto;
      max-height: 100%;
      scrollbar-width: none;
      -ms-overflow-style: none;
    }

    .popup-content::-webkit-scrollbar {
      display: none;
    }

    .popup-content img {
      width: 100%;
      max-height: 35vh;
      object-fit: contain;
      border-radius: 15px;
      margin-bottom: 20px;
    }

    .popup-content h3.name {
      font-size: 22px;
      font-weight: 700;
      color: #1C1C1C;
      margin: 0 0 10px;
    }

    .popup-content h3.description {
      font-size: 14px;
      color: #555;
      margin: 0 0 20px;
      padding: 0 10px;
      line-height: 1.4;
    }

    .add-to-cart-from-popup {
        width: 80%;
        margin: 16px auto 12px;
        padding: 14px 24px;
        display: block;
        text-align: center;
        transform: none !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        cursor: pointer;
      }

    .add-to-cart-from-popup:hover {
      background-color: #3b4ff6;
    }

    .popup-content .close-btn {
      position: absolute;
      top: 15px;
      right: 20px;
      width: 35px;
      height: 35px;
      background: none;
      border: none;
      cursor: pointer;
    }

    .close-btn::before,
    .close-btn::after {
      content: '';
      position: absolute;
      top: 50%;
      left: 50%;
      width: 24px;
      height: 2px;
      background-color: #333;
      transform-origin: center;
    }

    .close-btn::before {
      transform: translate(-50%, -50%) rotate(45deg);
    }

    .close-btn::after {
      transform: translate(-50%, -50%) rotate(-45deg);
    }


  .menu-site {
    width: 100%;
    max-width: none;
    padding: 20px 10px;
    background-color: #FDFDFD;
    margin: 0 auto;
  }

  .container {
    padding: 0 0.75rem;
  }

  .menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    padding: 0;
  }

  .menu-item {
    padding: 1rem;
    border-radius: 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  }

  .menu-item img {
    height: 140px;
    margin-bottom: 0.75rem;
  }

  .menu-item h3 {
    font-size: 0.95rem;
    min-height: 2.5rem;
    text-align: center;
    word-break: break-word;
    hyphens: auto;
  }

  .item-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.8rem;
    padding-top: 0.5rem;
    border-top: 1px dashed #eee;
    white-space: normal;
  }

  .item-info .price {
    font-size: 1.25rem;
    font-weight: 700;
    color: #000;
  }

  .item-info .item-details {
    font-size: 0.875rem;
    color: #888;
    word-break: break-word;
  }

  #cart-modal {
    width: 95%;
    max-width: 500px;
  }

  .cart-item img {
    width: 70px;
    height: 70px;
  }

  .cart-item-name,
  .cart-item-price {
    font-size: 0.9375rem;
  }
}

@media (max-width: 360px) {
  .menu-grid { gap: 0.5rem; }
  .menu-item { padding: 0.5rem; }
  .menu-item img { height: 100px; }
  .menu-item h3 { font-size: 0.875rem; min-height: 2.375rem; word-break: break-word; hyphens: auto; }
  .item-info .price { font-size: 1rem; }
}

.container {
  padding: 0 0.75rem;
}

/* Сетка товаров */
.menu-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  padding: 0;
}

.menu-item {
  padding: 0.75rem;
  border-radius: 0.75rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.menu-item img {
  height: 120px;
  margin-bottom: 0.75rem;
}

.menu-item h3 {
  font-size: 1rem;
  min-height: 2.5rem;
  text-align: center;
}

.item-info {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.875rem;
  padding-top: 0.5rem;
  border-top: 1px dashed #eee;
}

.item-info .price {
  font-size: 1.125rem;
  font-weight: 700;
  color: #000;
}

.item-info .item-details {
  font-size: 0.875rem;
  color: #888;
}

#cart-modal {
  width: 95%;
  max-width: 500px;
}

.cart-item img {
  width: 70px;
  height: 70px;
}

.cart-item-name,
.cart-item-price {
  font-size: 0.9375rem;
}

@media (max-width: 360px) {
  .menu-grid { gap: 0.5rem; }
  .menu-item { padding: 0.5rem; }
  .menu-item img { height: 100px; }
  .menu-item h3 { font-size: 0.875rem; min-height: 2.375rem; }
  .item-info .price { font-size: 1rem; }
}

@media (min-width: 768px) and (max-width: 1024px) {
  .menu-grid { grid-template-columns: repeat(3, 1fr); gap: 1rem; }
}

@media (min-width: 1025px) {
  .menu-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.25rem; }
}