    /* พื้นหลังมืด */
    .overlay {
      display: none;
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(0, 0, 0, 0.6);
      z-index: 999;
    }

    /* กล่อง Popup */
    #popup {
      display: none;
      position: fixed;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      width: 90%;
      /* กินพื้นที่ 90% ของจอ */
      max-width: 500px;
      /* จำกัดบนจอใหญ่ */
      max-height: 90vh;
      /* ไม่เกินความสูงหน้าจอ */
      overflow: auto;
      /* ถ้าเนื้อหาสูงเกิน จะเลื่อน */
      border-radius: 8px;
      background-color: transparent;
      z-index: 1000;
      box-shadow: 0 0 15px rgba(0, 0, 0, 0.4);
    }

    .close-button {
      text-align: right;
      font-size: 20px;
      color: white;
      cursor: pointer;
      padding: 2px 5px;
    }

    #popup img {
      width: 100%;
      height: auto;
      max-height: 90vh;
      /* ไม่เกินความสูงจอ */
      border-radius: 5px;
      object-fit: contain;
      /* ปรับให้พอดีจอ */
    }

    @media only screen and (max-width: 500px) {
      #popup {
        width: 90%;
        /* กินเกือบเต็มจอ แต่ไม่ติดขอบ */
        max-width: none;
        /* เอาข้อจำกัด max-width ออก */
      }
    }