/* หน้าพิมพ์ A4 ของรางวัล (ใช้ทั้งตัวอย่างบนจอและตอนพิมพ์) */
.a4 {
  width: 210mm; height: 297mm; background: #fff; color: #111; position: relative; overflow: hidden;
  font-family: 'TH SarabunPSK', 'Sarabun', Tahoma, sans-serif; box-shadow: 0 2px 10px rgba(0,0,0,.18); margin: 0 auto 8mm;
}
.a4 .pg { position: absolute; inset: 15mm; display: flex; flex-direction: column; gap: 4mm; }
.a4 .hidden { display: none !important; }
.sh-head { text-align: center; line-height: 1.12; flex: none; }
.sh-result { display: inline-block; font-size: 20pt; font-weight: 700; color: #8a5a00; border: 1.2pt solid #c9a227; border-radius: 99px; padding: 0 5mm; margin-bottom: 1.5mm; }
.sh-title { font-size: 25pt; font-weight: 700; margin: 0; line-height: 1.08; }
.sh-event { font-size: 18pt; margin-top: 1mm; }
.sh-who { font-size: 16pt; margin-top: 1mm; }
.sh-who b { color: #333; }
.sh-meta { font-size: 15pt; color: #444; margin-top: 1mm; }
.sh-body { position: relative; flex: none; }
.sh-cert { position: absolute; object-fit: contain; }
.sh-cell { position: absolute; overflow: hidden; background: #eef1f5; }
.sh-cell img { width: 100%; height: 100%; object-fit: cover; display: block; user-select: none; -webkit-user-drag: none; }
.sh-cell.empty { display: flex; align-items: center; justify-content: center; color: #8a94a6; font-size: 14pt; border: 1px dashed #b8c0cc; background: #f7f9fb; }
.sh-desc { flex: none; display: flex; flex-direction: row-reverse; gap: 4mm; align-items: flex-start; overflow: hidden; }
.sh-text { white-space: pre-wrap; line-height: 1.25; text-indent: 12mm; text-align: left; overflow-wrap: anywhere; }
.sh-qr { width: 24mm; flex: none; text-align: center; font-size: 11pt; color: #555; line-height: 1; }
.sh-qr svg { width: 24mm; height: 24mm; display: block; }

/* โหมดจัดหน้า: ช่องภาพกด/ลากได้ */
.sheet-edit .sh-cell { cursor: pointer; outline: 0 solid #1f4e8c; }
.sheet-edit .sh-cell:hover { outline-width: 2px; }
.sheet-edit .sh-cell.sel { outline: 3px solid #f59e0b; z-index: 2; }
.sheet-edit .sh-cell img { cursor: grab; }
.sheet-edit .sh-cell.dragging img { cursor: grabbing; }

/* ตัวอย่างย่อบนจอ: ย่อด้วย transform (ไม่กระทบการวัดขนาดด้วย offsetWidth) */
.sheet-wrap { overflow: clip; background: #dfe3ea; padding: 12px; border-radius: 8px; } /* clip: เลื่อน (scroll) ภายในไม่ได้ */
.sheet-scale { transform-origin: top left; width: 210mm; }
.sheet-scale .a4 { margin: 0; }

/* @page (ขอบ 0) อยู่ใน print.html เท่านั้น — หน้าอื่น (เช่น รายงานสรุป) ใช้ขอบกระดาษปกติ */
@media print {
  html, body { background: #fff !important; margin: 0; }
  .a4 { box-shadow: none; margin: 0; page-break-after: always; break-after: page; }
  .a4:last-child { page-break-after: auto; break-after: auto; }
  .noprint { display: none !important; }
  .sheet-wrap { padding: 0; background: none; overflow: visible; }
}
