:root {
  --maroon: #7a1f2b;
  --saffron: #e8772e;
  --turmeric: #f2b631;
  --green: #1f6b4f;
  --ink: #2b1a14;
  --muted: #6e5a4e;
  --line: #d9c4a0;
  --head: "Baloo 2", "Mukta", "Noto Sans Devanagari", sans-serif;
  --body: "Mukta", "Noto Sans Devanagari", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--body); color: var(--ink); background: #e9e3d8; }
[hidden] { display: none !important; }

/* ---------- टूलबार ---------- */
.toolbar {
  position: sticky; top: 0; z-index: 10; background: var(--maroon); color: #fff;
  padding: 10px 16px; box-shadow: 0 2px 10px rgba(0,0,0,.2);
}
.tb-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; max-width: 1100px; margin: 0 auto 6px; }
.tb-back { color: var(--turmeric); font-family: var(--head); font-weight: 800; font-size: 22px; text-decoration: none; margin-right: 6px; }
.toolbar select, .toolbar input {
  font-family: var(--body); font-size: 16px; padding: 6px 10px; border-radius: 10px; border: none; color: var(--ink);
}
#tb-sheet { font-weight: 700; max-width: 100%; }
.tb-event { display: flex; align-items: center; gap: 8px; font-weight: 600; flex: 1 1 280px; }
.tb-event input { flex: 1; min-width: 0; }
.tb-opts { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; flex: 1; }
.tb-opts label { display: flex; align-items: center; gap: 6px; font-size: 15px; }
.tb-opts input[type="text"] { width: 220px; }
.tb-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tb-btn {
  font-family: var(--body); font-weight: 700; font-size: 16px; border: none; border-radius: 999px; padding: 8px 18px; cursor: pointer;
  background: var(--saffron); color: #fff;
}
.tb-btn.green { background: #2f9a6f; }
.tb-btn.ghost { background: transparent; color: #fff; border: 2px solid rgba(255,255,255,.5); }
.tb-btn:disabled { opacity: .6; cursor: wait; }
.tb-status { max-width: 1100px; margin: 0 auto; font-size: 14px; color: #f7e3c9; min-height: 1em; }

/* ---------- A4 पान ---------- */
#doc { padding: 24px 0 60px; }
.sheet {
  width: 210mm; height: 297mm; margin: 0 auto 24px; background: #fff; position: relative; overflow: hidden;
  padding: 11mm 12mm 10mm; display: flex; flex-direction: column;
  box-shadow: 0 4px 18px rgba(0,0,0,.15);
  font-size: 14.5px; line-height: 1.45;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.sh-stripe { position: absolute; left: 0; right: 0; top: 0; height: 5mm; display: flex; }
.sh-stripe i { flex: 1; background: var(--saffron); }
.sh-stripe i:nth-child(3n+2) { background: var(--turmeric); }
.sh-stripe i:nth-child(3n) { background: var(--green); }
.sh-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; border-bottom: 2px solid var(--maroon); padding: 3mm 0 2mm; margin-bottom: 4mm; }
.sh-head h1 { font-family: var(--head); font-size: 26px; line-height: 1.15; color: var(--maroon); margin: 0; }
.sh-head .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.sh-right { text-align: right; flex-shrink: 0; }
.sh-brand { font-family: var(--head); font-weight: 800; color: var(--saffron); font-size: 18px; }
.sh-event { font-weight: 700; font-size: 14px; color: var(--green); max-width: 70mm; }
.sh-body { flex: 1; min-height: 0; }
.sh-foot { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 2mm; margin-top: 3mm; }

.name-line { display: flex; gap: 14px; margin-bottom: 4mm; font-weight: 600; }
.name-line span { flex: 1; border-bottom: 1.5px dotted #999; padding-bottom: 2px; }
.name-line span.short { flex: 0 0 32mm; }
.howto { background: #fff6e4; border-left: 4px solid var(--saffron); padding: 2.5mm 4mm; margin-bottom: 4mm; font-size: 13.5px; border-radius: 0 6px 6px 0; }

.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 3mm 7mm; }
.cols3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 3mm 5mm; }
.q { break-inside: avoid; }
.q .n { font-family: var(--head); font-weight: 800; color: var(--saffron); margin-right: 4px; }
.ans-line { border-bottom: 1.5px dotted #999; height: 7mm; margin-top: 1mm; font-size: 12px; color: #aaa; }

/* कापायचे कार्ड */
.cut-grid { display: grid; gap: 0; border-top: 1.5px dashed #999; border-left: 1.5px dashed #999; }
.cut { border-right: 1.5px dashed #999; border-bottom: 1.5px dashed #999; padding: 4mm; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; position: relative; }
.cut .tag { position: absolute; top: 1.5mm; left: 2mm; font-size: 10px; color: var(--muted); font-weight: 700; }
.cut .mini { position: absolute; bottom: 1.5mm; right: 2mm; font-size: 9px; color: #c9b38c; font-family: var(--head); }
.scissor { font-size: 12px; color: var(--muted); margin-bottom: 1.5mm; }

/* तक्ते */
table.grid { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.grid th, table.grid td { border: 1px solid #b9a582; padding: 1.6mm 2mm; text-align: left; }
table.grid th { background: #fbecd2; color: var(--maroon); font-weight: 700; }
table.grid td.c, table.grid th.c { text-align: center; }
table.grid tr.total td { font-weight: 800; background: #f7f1e6; }

/* हौजी तिकीट */
.tickets { display: grid; grid-template-columns: 1fr 1fr; gap: 3.5mm 6mm; }
.ticket { border: 2px solid var(--maroon); border-radius: 3mm; overflow: hidden; break-inside: avoid; }
.ticket .th { display: flex; justify-content: space-between; background: var(--maroon); color: #fff; font-size: 11.5px; padding: 1mm 2.5mm; font-weight: 700; }
.ticket .th .tn { color: var(--turmeric); }
.ticket table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.ticket td { border: 1px solid #c9b38c; height: 9.4mm; text-align: center; font-family: var(--head); font-weight: 800; font-size: 19px; color: var(--ink); }
.ticket td.e { background: repeating-linear-gradient(45deg, #fdf3df 0 3px, #fff 3px 6px); }

.hboard { display: grid; grid-template-columns: repeat(10, 1fr); border-top: 1px solid #b9a582; border-left: 1px solid #b9a582; }
.hboard div { border-right: 1px solid #b9a582; border-bottom: 1px solid #b9a582; height: 22mm; padding: 1mm; text-align: center; }
.hboard b { display: block; font-family: var(--head); font-size: 22px; color: var(--maroon); line-height: 1.2; }
.hboard span { font-size: 10px; display: block; line-height: 1.2; }
.hboard i { font-style: normal; font-size: 8.5px; color: var(--green); display: block; line-height: 1.15; margin-top: 1px; }

/* बिंगो */
.bingo { display: grid; grid-template-columns: repeat(5, 1fr); border: 2.5px solid var(--maroon); }
.bingo div { border: 1px solid #c9b38c; height: 36mm; padding: 2mm; display: flex; flex-direction: column; justify-content: space-between; text-align: center; font-size: 13px; font-weight: 600; }
.bingo div .sig { border-top: 1px dotted #999; font-size: 10px; color: #aaa; font-weight: 400; padding-top: 1mm; }
.bingo div.free { background: var(--turmeric); color: var(--maroon); font-family: var(--head); font-size: 20px; font-weight: 800; justify-content: center; }

/* प्रश्नमंजुषा */
.quiz-q { margin-bottom: 3.6mm; break-inside: avoid; }
.quiz-q .qt { font-weight: 700; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6mm 6mm; margin: 1mm 0 0 6mm; font-size: 13.5px; }
.opts span::before { content: "◯ "; color: var(--saffron); }

.key { columns: 2; column-gap: 8mm; font-size: 13px; }
.key div { break-inside: avoid; padding: 1mm 0; border-bottom: 1px dotted #ddd; }
.key b { color: var(--maroon); }

.emo { font-size: 34px; letter-spacing: 3px; line-height: 1.2; }
.jtiles { display: flex; gap: 2mm; flex-wrap: wrap; margin-top: 1mm; }
.jtiles span { border: 1.5px solid var(--turmeric); background: #fff6e4; border-radius: 2mm; padding: 0 3mm; font-family: var(--head); font-size: 22px; font-weight: 700; }
.hintx { font-size: 11.5px; color: var(--muted); }

/* पाटी */
.patti {
  border: 5px solid #1a1a1a; border-radius: 3mm; padding: 10mm 12mm; text-align: center; font-weight: 700;
  display: flex; flex-direction: column; justify-content: center; gap: 5mm; position: relative; height: 100%;
}
.patti::before, .patti::after { content: ""; position: absolute; top: 4mm; width: 4mm; height: 4mm; border-radius: 50%; background: #777; }
.patti::before { left: 4mm; } .patti::after { right: 4mm; }
.patti .pt { align-self: center; background: #c0392b; color: #fff; padding: 0 8mm; border-radius: 2mm; font-size: 22px; letter-spacing: 2px; }
.patti .tx { font-size: 30px; line-height: 1.4; }
.patti .sg { align-self: flex-end; font-size: 16px; color: #444; }
.patti-pair { display: grid; grid-template-rows: 1fr 1fr; gap: 10mm; height: 100%; }

.song { break-inside: avoid; margin-bottom: 4mm; }
.song h3, .mg h3 { font-family: var(--head); color: var(--maroon); font-size: 18px; margin: 0 0 1mm; }
.song ul { margin: 0; padding-left: 5mm; font-size: 13.5px; }
.mg { break-inside: avoid; border: 1.5px solid var(--line); border-radius: 3mm; padding: 3mm 4mm; }
.mg p { margin: 1mm 0; font-size: 13px; }
.mg .win { border-top: 1px dotted #999; margin-top: 2mm; padding-top: 1mm; font-size: 12px; color: #999; }

.big-wish { text-align: center; padding: 8mm 0 4mm; }
.big-wish h2 { font-family: var(--head); font-size: 40px; color: var(--maroon); margin: 0; line-height: 1.2; }
.wbox { border: 1.5px dashed var(--line); border-radius: 3mm; height: 30mm; padding: 2mm 3mm; font-size: 11px; color: #bbb; }

/* PDF बनवताना */
body.exporting .sheet { box-shadow: none; margin: 0; }
body.exporting #doc { zoom: 1 !important; }

@page { size: A4; margin: 0; }
@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
  #doc { padding: 0; }
  .sheet { margin: 0; box-shadow: none; break-after: page; page-break-after: always; }
  .sheet:last-child { break-after: auto; page-break-after: auto; }
}
@media screen and (max-width: 860px) {
  #doc { zoom: 0.45; }
  .tb-opts input[type="text"] { width: 150px; }
}

/* ---------- नवी पत्रके ---------- */
.diya { width: 1.15em; height: 1.15em; vertical-align: -0.2em; margin-right: 3px; }
.bingo div.free .diya { width: 34px; height: 34px; display: block; margin: 0 auto 2px; }
.big-wish .diya { width: 56px; height: 56px; }
.rmark { width: 13mm; height: 13mm; border-radius: 50%; border: 2px solid var(--maroon); display: flex; align-items: center; justify-content: center; font-family: var(--head); font-weight: 800; font-size: 22px; color: var(--maroon); margin-bottom: 1mm; padding-top: 1mm; }
.aarti-big { display: flex; flex-direction: column; align-items: center; text-align: center; font-size: 19px; line-height: 1.75; margin-top: 4mm; }
.aarti-big .gap { margin-bottom: 4mm; }
.rangoli-print { display: flex; justify-content: center; margin-top: 4mm; }
.rangoli-print svg { width: 172mm; height: 172mm; }
.cal { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4mm; }
.cal div { border: 1.5px solid var(--line); border-top: 4px solid var(--saffron); border-radius: 2mm; padding: 3mm 4mm; min-height: 52mm; position: relative; }
.cal b { font-family: var(--head); font-size: 24px; color: var(--maroon); display: block; }
.cal p { margin: 1mm 0 0; font-size: 13.5px; }
.cal .cn { position: absolute; right: 3mm; top: 2mm; font-family: var(--head); color: #e8d2a6; font-size: 22px; font-weight: 800; }
.tagc, .labelc { gap: 0.6mm; font-size: 12px; }
.tagc b { font-family: var(--head); font-size: 16px; color: var(--maroon); }
.tagc .diya { width: 22px; height: 22px; margin: 0; }
.tagc .hole { position: absolute; top: 2.5mm; width: 4mm; height: 4mm; border-radius: 50%; border: 1px solid #999; }
.tagc .from, .labelc .from { font-size: 11px; color: var(--muted); }
.tagc .ev { font-size: 10px; color: var(--green); font-weight: 700; }
.labelc b { font-family: var(--head); font-size: 26px; color: var(--maroon); line-height: 1.1; }
.labelc .lt { font-size: 11px; letter-spacing: 1px; color: var(--saffron); font-weight: 700; }
.box { display: inline-block; width: 4.5mm; height: 4.5mm; border: 1.5px solid #777; border-radius: 1mm; }
.stars { letter-spacing: 1px; color: #c9a54a; }
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 8mm; }
.mrow { display: flex; align-items: center; gap: 2mm; min-height: 15mm; border-bottom: 1px dotted #ccc; font-size: 14px; }
.mrow .n { font-family: var(--head); font-weight: 800; color: var(--saffron); min-width: 7mm; }
.mbox { margin-left: auto; width: 9mm; height: 8mm; border: 1.5px solid #999; border-radius: 1.5mm; flex-shrink: 0; }
.songcols { columns: 2; column-gap: 8mm; font-size: 14px; }
.songcols .q { margin-bottom: 2.5mm; }
.sl { display: inline-flex; width: 8mm; height: 8mm; border-radius: 50%; background: var(--maroon); color: #fff; align-items: center; justify-content: center; font-family: var(--head); margin-right: 2mm; padding-top: 1mm; }


/* ---------- नाटकाची संहिता ---------- */
.flow { font-size: 14px; line-height: 1.6; }
.nt-about { font-size: 15px; color: var(--maroon); font-weight: 600; margin: 0 0 2mm; }
.nt-h { font-family: var(--head); color: var(--saffron); font-size: 17px; margin: 4mm 0 1.5mm; border-bottom: 1px solid var(--line); }
.nt-cast { font-size: 13px; margin-bottom: 2mm; }
.nt-props { font-size: 13px; background: #fff6e4; padding: 2mm 3mm; border-radius: 2mm; }
.nt-ln { margin: 0 0 1.6mm; padding-left: 4mm; text-indent: -4mm; }
.nt-ln b { color: var(--maroon); }
.nt-dir { margin: 0 0 1.6mm 6mm; font-style: italic; color: var(--muted); }
.nt-end { text-align: center; font-family: var(--head); color: var(--muted); margin-top: 4mm; }

.nt-song { margin: 1mm 0 2.5mm 10mm; padding: 1.5mm 4mm; border-left: 3px solid var(--saffron); background: #fff6e4; font-style: italic; display: flex; flex-direction: column; }
.nt-note { margin: 0 0 1.4mm; font-size: 13px; }
