/* Cut The Fruit Game Styles */
.main-text {
  margin-top: 100px;
}

.cuts-section {
  max-width: 780px;
  margin: 60px auto 0 auto;
  padding: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0));
  border-radius: 18px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.74);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.cuts-section::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(255,255,255,0.65), rgba(255,255,255,0) 40%);
  pointer-events: none;
  opacity: 0.55;
}

.canvas-wrap {
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.04);
  position: relative;
  z-index: 1;
}

#cuts-canvas {
  width: 100%;
  height: 440px;
  display: block;
  touch-action: none;
}

.hmc-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(12, 14, 22, 0.68);
  backdrop-filter: blur(8px);
  z-index: 30;
}

.hmc-overlay-card {
  width: min(420px, calc(100% - 48px));
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 22px;
  padding: 22px 22px 20px;
  text-align: center;
  box-shadow: 0 28px 70px rgba(0,0,0,0.35);
}

.hmc-overlay-title {
  font-size: 2.1rem;
  font-weight: 900;
  color: #0d1020;
  letter-spacing: 0.01em;
}

.hmc-overlay-subtitle {
  margin-top: 6px;
  font-size: 1.02rem;
  font-weight: 600;
  color: rgba(13, 16, 32, 0.75);
}

.hmc-score-label {
  margin-top: 16px;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(13, 16, 32, 0.55);
}

.hmc-score-label-tight {
  margin-top: 12px;
}

.hmc-score {
  margin-top: 6px;
  font-size: 4.1rem;
  font-weight: 900;
  line-height: 1;
  color: #0d1020;
}

.hmc-score-small {
  font-size: 2.4rem;
  opacity: 0.9;
}

.hmc-overlay-btn {
  margin-top: 18px;
  padding: 12px 42px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  color: #fff;
  font-weight: 900;
  font-size: 1.1rem;
  background: linear-gradient(90deg, #111 0%, #2a2f4a 100%);
  box-shadow: 0 18px 44px rgba(0,0,0,0.22);
  transition: transform 0.12s, box-shadow 0.2s, filter 0.2s;
  font-family: 'Poppins', sans-serif;
}

.hmc-overlay-btn:hover {
  transform: translateY(-2px);
  filter: saturate(1.1);
  box-shadow: 0 22px 52px rgba(0,0,0,0.28);
}

.hmc-overlay-btn:active {
  transform: translateY(0px) scale(0.99);
}

.cuts-hint {
  margin-top: 10px;
  font-weight: 700;
  color: rgba(0, 0, 0, 0.55);
  position: relative;
  z-index: 1;
}

.asset-hint {
  margin-top: 6px;
  font-weight: 700;
  color: rgba(0, 0, 0, 0.55);
  text-align: center;
  position: relative;
  z-index: 1;
}

@media (max-width: 600px) {
  .main-text {
      margin-top: 60px;
  }
  .cuts-section {
      max-width: 90%;
      margin: 20px auto 0 auto;
      padding: 12px 14px;
  }
  #cuts-canvas {
    height: 380px;
  }

  /* Overlay / menu adjustments for small screens */
  .hmc-overlay-card {
    width: min(360px, calc(100% - 32px));
    padding: 14px 14px 12px;
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(0,0,0,0.28);
  }

  .hmc-overlay-title {
    font-size: 1.6rem;
    line-height: 1.05;
  }

  .hmc-overlay-subtitle {
    font-size: 0.95rem;
  }

  .hmc-score {
    font-size: 3rem;
  }

  .hmc-score-small {
    font-size: 1.6rem;
  }

  .hmc-overlay-btn {
    padding: 10px 20px;
    font-size: 1rem;
    width: 100%;
    box-sizing: border-box;
    border-radius: 999px;
    box-shadow: 0 14px 36px rgba(0,0,0,0.22);
  }

  .hmc-overlay-btn:hover {
    transform: translateY(-1px);
  }

  .hmc-overlay-btn:active {
    transform: translateY(0) scale(0.995);
  }

  .hmc-overlay-card .hmc-overlay-subtitle,
  .hmc-overlay-card .hmc-score-label {
    margin-top: 6px;
  }

  /* Reduce decorative/start-menu images so the start button fits */
  .hmc-overlay-card img {
    max-width: 28px;
    max-height: 28px;
    /* width: auto;
    height: auto; */
    display: block;
    margin: 8px auto;
  }

    /* Force 7 images per row: use a wrapping flex container if present,
       and fallback to sizing all images to fit seven across the card. */
    .hmc-overlay-card .fruit-grid {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      justify-content: center;
      align-items: center;
    }

    .hmc-overlay-card .fruit-grid img {
      flex: 0 0 calc((100% - 6 * 6px) / 7);
      max-width: calc((100% - 6 * 6px) / 7);
      margin: 2px;
    }

    /* Fallback: if there's no .fruit-grid wrapper, make all images small enough */
    .hmc-overlay-card img:not(.no-shrink) {
      width: calc((100% - 6 * 6px) / 7);
      max-width: none;
      height: auto;
      display: inline-block;
      margin: 2px 3px;
    }

    /* Target the actual chooser markup used by the JS: #fruit-choices and .fruit-choice */
    .hmc-overlay-card #fruit-choices {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      justify-content: center;
      align-items: center;
      width: calc(100% - 32px);
      max-width: none;
      margin-top: 8px;
    }

    .hmc-overlay-card #fruit-choices .fruit-choice {
      /* Make seven equal columns (subtracting gaps). */
      flex: 0 0 calc((100% - 6 * 6px) / 7);
      box-sizing: border-box;
      padding: 2px;
      margin: 0;
      height: auto;
    }

    .hmc-overlay-card #fruit-choices .fruit-choice img {
      width: 100%;
      max-width: none;
      height: auto;
      display: block;
      border-radius: 6px;
      background: #fff;
    }

    /* Fallback for any other images inside the card */
    .hmc-overlay-card img:not(.no-shrink) {
      max-width: calc((100% - 6 * 6px) / 7);
      height: auto;
      margin: 2px;
      display: inline-block;
    }
  /* Ensure the overlay card never exceeds viewport and shows content without requiring extra scroll */
  .hmc-overlay-card {
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  /* Reduce vertical spacing so CTA is visible */
  .hmc-overlay-btn {
    margin-top: 12px;
  }

  /* Force 7 images per row: use a wrapping flex container if present,
     and fallback to sizing all images to fit seven across the card. */
  .hmc-overlay-card .fruit-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    align-items: center;
  }

  .hmc-overlay-card .fruit-grid img {
    flex: 0 0 calc((100% - 6 * 6px) / 7);
    max-width: calc((100% - 6 * 6px) / 7);
    margin: 2px;
  }

  /* Fallback: if there's no .fruit-grid wrapper, make all images small enough */
  .hmc-overlay-card img:not(.no-shrink) {
    width: calc((100% - 6 * 6px) / 7);
    max-width: none;
    height: auto;
    display: inline-block;
    margin: 2px 3px;
  }
}
