
.jigsaw-test-page {
  min-height: 100vh;
  padding: 6px 10px 14px;
}

.jigsaw-test-shell {
  width: min(1340px, 100%);
  margin: 0 auto;
}

.jigsaw-back-link {
  display: inline-block;
  margin-bottom: 4px;
  font-weight: 700;
}

.jigsaw-test-card {
  padding: 8px 10px 10px;
}

/* Short dark strip: only the developer badge and the playing tip. */
.jigsaw-top-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 34px;
  margin-bottom: 6px;
}

.jigsaw-help {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: #e7f1f6;
}

/* The puzzle title, status, controls, board and tray now share one light area. */
.jigsaw-puzzle-area {
  padding: 8px;
  border-radius: 14px;
  background: #eef5f7;
  color: #142d38;
}

.jigsaw-board-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 6px;
}

.jigsaw-board-heading {
  min-width: 0;
}

.jigsaw-test-card h1 {
  margin: 0 0 3px;
  font-size: clamp(1.2rem, 1.8vw, 1.6rem);
  line-height: 1.15;
  color: #102a36;
}

.jigsaw-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  justify-content: flex-end;
}


#jigsaw-undo:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  filter: grayscale(0.25);
}

#jigsaw-preview.small-btn.primary-small {
  opacity: 1;
  filter: none;
}


.jigsaw-status {
  min-height: 1.15em;
  margin: 0;
  font-weight: 700;
  font-size: 0.98rem;
  color: #1f3e4b;
}

.jigsaw-canvas-wrap {
  width: 100%;
  overflow: auto;
  border: 2px solid rgba(25, 55, 75, 0.25);
  border-radius: 12px;
  background: #eef5f7;
}

#jigsaw-canvas {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: calc(100vh - 165px);
  height: auto;
  margin: 0 auto;
  touch-action: none;
  cursor: grab;
}

#jigsaw-canvas.dragging {
  cursor: grabbing;
}

@media (max-width: 860px) {
  .jigsaw-top-strip,
  .jigsaw-board-header {
    flex-direction: column;
    align-items: stretch;
  }

  .jigsaw-top-strip {
    gap: 5px;
  }

  .jigsaw-controls {
    justify-content: flex-start;
  }
}

@media (max-width: 700px) {
  .jigsaw-test-page {
    padding: 6px 6px 12px;
  }

  .jigsaw-test-card {
    padding: 7px;
  }

  .jigsaw-puzzle-area {
    padding: 6px;
  }

  .jigsaw-status,
  .jigsaw-help {
    font-size: 0.84rem;
  }
}

.jigsaw-preview-popup[hidden] {
  display: none !important;
}

/* Open the picture from the left so it cannot cover the pill buttons. */
.jigsaw-preview-popup {
  position: fixed;
  top: 24px;
  left: 24px;
  z-index: 50;
}

.jigsaw-preview-panel {
  width: min(360px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: #ffffff;
  border: 2px solid rgba(25, 55, 75, 0.22);
  border-radius: 18px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.22);
  padding: 14px;
}

.jigsaw-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.jigsaw-preview-head h2 {
  margin: 0;
  font-size: 1.1rem;
  color: #17313c;
}

#jigsaw-preview-image {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid rgba(25, 55, 75, 0.18);
  background: #eef5f7;
}

@media (max-width: 1180px) {
  .jigsaw-preview-popup {
    top: auto;
    right: 12px;
    left: 12px;
    bottom: 12px;
  }

  .jigsaw-preview-panel {
    width: min(500px, 100%);
    margin-right: auto;
  }
}

@media (max-height: 760px) and (min-width: 701px) {
  #jigsaw-canvas {
    max-height: calc(100vh - 145px);
  }
}
