#squareThings {
  margin: 0;
  padding: 0;
  background-color: #11ffee00;
  color: #fff;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  overflow: hidden;
}

#graphic {
  width: 100%;      /* full width of container/site */
  /* Height is dynamically set via JS based on how many rows (2-4) fit; initial fallback */
  height: 440px;    /* fallback: 4 rows */
  position: relative;
  overflow: auto;
  background-color: #11ffee00;
  overflow: hidden;
}

/* A placed square that snaps to grid cell coordinates */
.square {
  position: absolute;             /* allow placement by left/top */
  width: 150px;
  height: 150px;
  box-sizing: border-box;         /* include border inside 110px */
  /* border: 1px solid rgba(255,255,255,0.6); */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;                     /* ensure above background grid */
}

@media (max-width: 800px) {
  .square {
    width: 75px;
    height: 75px;
  }
}

.square > a {
  display: block;
  width: 100%;
  height: 100%;
}

.square img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.square:hover img {
  transform: scale(0.75);
}

/* Small floating label to show current grid coordinates */
#coordReadout {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 4px 8px;
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  font-size: 12px;
  pointer-events: none;
  display: none; /* hidden by default; keep code for debugging */
}

/* Dimming behavior: when a square is selected, dim all others except matches */
#graphic.has-selection .square:not(.selected):not(.match) img {
  opacity: 0.25;
}

/* Ensure selected stays fully visible */
#graphic.has-selection .square.selected img {
  opacity: 1;
}

/* Scale up the selected SVG to 130% and keep it above neighbors */
#graphic.has-selection .square.selected {
  z-index: 3;
}

#graphic.has-selection .square.selected img {
  transform: scale(1.3);
}

/* Prevent hover shrink from overriding selected scale */
#graphic.has-selection .square.selected:hover img {
  transform: scale(1.3);
}

/* Matching asset squares should also stay visible and scale */
#graphic.has-selection .square.match {
  z-index: 2;
}

#graphic.has-selection .square.match img {
  opacity: 1;
  transform: scale(1.3);
}

#graphic.has-selection .square.match:hover img {
  transform: scale(1.3);
}

/* Floating label for selected SVG */
.svg-label {
  font-family: "itc-avant-garde-gothic-pro", Sans-serif;
  position: absolute;
  z-index: 10;
  /* background: rgba(0,0,0,0.85); */
  color: #fff;
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 16px;
  /* font-weight: 900; */
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none; /* don't block clicks */
  /* box-shadow: 0 2px 8px rgba(0,0,0,0.5); */
}