.modal {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
    align-items: center;
    justify-content: center;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  
  .modal-inner {
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    position: relative;
  }
  
  .modal-swiper {
    width: 100%;
    height: auto;
    min-height: 50vh; /* ensure visible area */
    position: relative;
    touch-action: pan-y pinch-zoom;
  }
  
  .modal-swiper .swiper-wrapper {
    width: 100%;
    height: auto !important;
    min-height: inherit; /* carry min-height */
  }
  
  .modal-swiper .swiper-slide {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    width: 100% !important;
    height: auto !important;
    min-height: inherit; /* ensure slide has height */
    max-width: none !important;
    box-sizing: border-box !important;
    flex-shrink: 0;
    position: relative;
  }
  
  .modal-content {
    display: block; /* avoid inline baseline issues */
    max-width: 100%;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    animation: zoomIn 0.3s ease;
    transition: transform 0.3s ease;
    z-index: 1;
    touch-action: manipulation;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
  }
  
  .slider-nav {
    font-size: 60px;
    color: #fff;
    padding: 10px;
    cursor: pointer;
    user-select: none;
    z-index: 2;
    background: rgba(0,0,0,0.3);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    min-width: 44px;
    min-height: 44px;
  }
  
  .slider-nav:hover { background: rgba(0,0,0,0.6); transform: scale(1.1); }
  .slider-nav:active { transform: scale(0.95); }
  .slider-nav.left { position: absolute; left: 10px; }
  .slider-nav.right { position: absolute; right: 10px; }
  
  .swiper-pagination { bottom: 20px !important; }
  .swiper-pagination-bullet { background: rgba(255,255,255,0.5); opacity: 1; transition: all 0.3s ease; min-width: 12px; min-height: 12px; }
  .swiper-pagination-bullet:hover { background: rgba(255,255,255,0.8); transform: scale(1.2); }
  .swiper-pagination-bullet-active { background: #fff; transform: scale(1.3); }
  
  .close {
    position: absolute; top: -40px; right: 0; color: #fff; font-size: 35px; font-weight: bold; cursor: pointer; z-index: 3;
    background: rgba(0,0,0,0.3); border-radius: 50%; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; transition: all 0.3s ease; min-width: 44px; min-height: 44px;
  }
  .close:hover { background: rgba(0,0,0,0.6); transform: scale(1.1); }
  .close:active { transform: scale(0.95); }
  
  @keyframes zoomIn { from { opacity: 0; transform: scale(0.5);} to { opacity: 1; transform: scale(1);} }
  
  @media (max-width: 768px) {
    .modal-inner { max-width: 95%; padding: 0 10px; }
    .slider-nav { width: 40px; height: 40px; font-size: 24px; }
    .slider-nav.left { left: 5px; }
    .slider-nav.right { right: 5px; }
    .close { top: 0; right: 5px; width: 40px; height: 40px; font-size: 30px; }
    .modal-content { max-height: 80vh; }
    .modal-swiper { touch-action: pan-x pan-y; }
  }
  
  @media (max-width: 480px) {
    .slider-nav { width: 35px; height: 35px; font-size: 20px; }
    .close { width: 40px; height: 40px; font-size: 30px; }
    .modal-inner { max-width: 98%; padding: 0 5px; }
  }
  
  @media (hover: none) and (pointer: coarse) {
    .slider-nav:hover { background: rgba(0,0,0,0.3); transform: none; }
    .close:hover { background: rgba(0,0,0,0.3); transform: none; }
    .swiper-pagination-bullet:hover { background: rgba(255,255,255,0.5); transform: none; }
  }
  
  /* Override device-styles.css conflicting rules */
  #imageModal .modal-swiper .swiper-slide {
    width: 100% !important;
    max-width: none !important;
    box-sizing: border-box !important;
  }
  
  .modal-content {
    display: block; /* avoid inline baseline issues */
    max-width: 100%;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    animation: zoomIn 0.3s ease;
    transition: transform 0.3s ease;
    z-index: 1;
    touch-action: manipulation;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
  }
  
  