/* -------- Global layout -------- */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #eef1f7;
  color: #222;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.app-container {
  text-align: center;
  padding: 24px;
  max-width: 520px;
  width: 100%;
}

/* -------- Text -------- */

h1 {
  font-size: 1.5rem;
  margin-bottom: 1.25rem;
}

/* -------- Card + grid -------- */

.card-wrapper {
  display: flex;
  justify-content: center;
  margin-bottom: 1.25rem;
}

/* Card container around the 3x4 grid */
.card {
  background: linear-gradient(180deg, #ffffff 0%, #f6f3ff 45%, #fef1f1 100%);
  padding: 16px 18px;
  border-radius: 22px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  display: inline-block;
  max-width: 320px;
  width: 100%;
}

/* 3 x 4 grid inside the card */
.pattern-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  /* Scale with viewport, but clamp to reasonable max */
  width: min(70vw, 260px);
  margin: 0 auto;
}

/* -------- Cells -------- */

.cell {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  background-color: #ffffff;
}

.cell.empty {
  background-image: none;
}

/* -------- Buttons -------- */

.buttons-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.btn {
  padding: 10px 18px;
  font-size: 0.95rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.1s ease, opacity 0.1s ease, box-shadow 0.1s ease,
    background-color 0.1s ease, color 0.1s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.btn:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.primary-btn {
  background: #2563eb;
  color: #ffffff;
}

/* -------- Footer -------- */

.footer {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: #888;
}

/* -------- Mobile responsiveness -------- */

@media (max-width: 600px) {
  body {
    align-items: flex-start;
  }

  .app-container {
    padding: 16px;
    margin-top: 16px;
  }

  h1 {
    font-size: 1.25rem;
  }

  .card {
    padding: 12px 14px;
    border-radius: 18px;
  }

  .pattern-grid {
    width: min(90vw, 260px); /* use more width on tiny screens */
    gap: 4px;
  }

  .btn {
    width: 100%;
    max-width: 280px;
  }
}

@media (max-width: 360px) {
  h1 {
    font-size: 1.1rem;
  }

  .pattern-grid {
    width: min(94vw, 240px);
    gap: 3px;
  }
}
