.kodim-container {
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow: auto;      /* Allow scrolling */
  margin: 0 auto;
  text-align: center;
}

#kodim-canvas {
  display: block;
  margin: 0 auto;
  /* Removed any width/height control here */
}

  #kodim-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    z-index: 1000;
    pointer-events: none;   /* Default: allow hover */
    touch-action: manipulation;
  }

  /* Enable pointer events on touch devices */
  @media (hover: none) and (pointer: coarse) {
    #kodim-overlay {
      pointer-events: auto;
    }
  }

  .kodim-tooltip {
    position: absolute;
    background: #333;
    color: #fff;
    padding: 4px 8px;                      /* Reduced padding */
    border-radius: 4px;                    /* Slightly smaller corners */
    white-space: pre-line;
    z-index: 9999;
    font-size: clamp(10px, 2vw, 12px);     /* Smaller font size */
    max-width: 60vw;                       /* Reduce max width */
    line-height: 1.3;                      /* Slightly tighter line spacing */
  }

  #kodim-loading-overlay {
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
    color: #555;
    padding: 1rem;
    display: none;
  }

/* 🎯 Adjusted ONLY this part */

.canvas-container {
  position: relative !important;
  display: inline-block;  /* Important for horizontal scrolling */
}

.canvas-container canvas {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  /* No width or height control here */
  background-color: transparent !important;
  background-size: contain !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
}

.kodim-info-box {
  background: #fff;
  border: 1px solid #ccc;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  padding: 10px;
  border-radius: 6px;
  position: absolute;
  z-index: 9999;
  max-width: 200px;
}
/* Lightbox image scaling for mobile portrait */
@media screen and (orientation: portrait) and (max-width: 768px) {
  #lightbox .lb-image {
    max-width: 90vw !important;
    max-height: 60vh !important;
    object-fit: contain;
  }
}