:root {
  --bg-color: #fff8ec;
}
body {
  font-family: "Mali", "Noto Sans Thai", sans-serif;
  margin: 0;
  padding: 20px;
  background: #f0f0f0;
}
.controls {
  text-align: center;
  margin-bottom: 20px;
}
button {
  font-family: inherit;
  background: #4caf50;
  color: white;
  font-size: 24px;
  padding: 15px 30px;
  border-radius: 30px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.page {
  background: white;
  width: 210mm;
  height: 297mm;
  margin: 0 auto 20px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  padding: 10mm;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: repeat(4, 1fr);
  gap: 6mm;
  page-break-after: always;
}
.cover-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20mm;
}
.cover-page h1 {
  font-size: 48px;
  margin-bottom: 10px;
}
.cover-page h2 {
  font-size: 32px;
  color: #666;
  margin-bottom: 40px;
}
.instructions {
  text-align: left;
  font-size: 24px;
  background: var(--bg-color);
  padding: 30px;
  border-radius: 20px;
}
.instructions li {
  margin-bottom: 15px;
}

.print-card {
  border: 3px dashed #ccc;
  border-radius: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px;
  text-align: center;
  position: relative;
}
.print-card::before {
  content: "";
  position: absolute;
  top: 5px;
  left: 5px;
  right: 5px;
  bottom: 5px;
  border: 4px solid;
  border-radius: 22px;
  border-color: inherit; /* will be set via js */
  pointer-events: none;
}
.print-card img {
  width: 38mm;
  height: 38mm;
  object-fit: contain;
  margin-bottom: 4px;
  mix-blend-mode: multiply;
}
.print-card h3 {
  font-size: 32px;
  margin: 0 0 2px 0;
  color: #333;
}
.print-card p {
  font-size: 24px;
  margin: 0;
  color: #666;
}
.fallback-circle {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  color: white;
  font-weight: bold;
  margin-bottom: 20px;
}

@media print {
  body {
    background: white;
    padding: 0;
  }
  .controls {
    display: none;
  }
  .page {
    box-shadow: none;
    margin: 0;
  }
  @page {
    size: A4;
    margin: 10mm;
  }
}
