.explanation-group {
  position: relative;
  max-width: 480px;
  margin: 0 auto 0.8rem auto;
  min-height: 220px;
}

.explanation-group .watermark-bg {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 80%;
  max-width: 320px;
  opacity: 0.10;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 0;
}

.explanation-group .watermark-content {
  position: relative;
  z-index: 1;
}
:root {
  --bg: #f0fdf4;
  --card: #fff;
  --text: #111827;
  --border: #d1fae5;
  --primary: #16a34a;
  --primary-hover: #15803d;
  --danger: #dc2626;
  --success: #059669;
  --muted: #6b7280;
  --accent: #047857;
}

/* =========================
   Global Reset
   ========================= */
* {
  box-sizing: border-box;
}
body {
  font-family: "Gayathri", Calibri, Arial, sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}

/* =========================
   Header & Footer
   ========================= */
.app-header {
  max-width: 480px;
  margin: 0 auto;
  padding: 12px 0 0;
}
.app-header .header-img {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
  border-radius: 12px;
}
.app-footer {
  text-align: center;
  padding: 16px 12px;
  background: #065f46;
  color: #d1fae5;
  font-size: 0.85rem;
  max-width: 480px;
  margin: 32px auto 0 auto;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.footer-container {
  max-width: 480px;
  margin: 32px auto 0 auto;
  padding: 0 8px;
}
.app-footer p {
  margin: 0;
}

/* =========================
   Container
   ========================= */
.container {
  max-width: 480px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 16px;
  margin-top: 12px;
  margin-bottom: 12px;
}
h1 {
  font-family: "Gayathri", Calibri, Arial, sans-serif;
  margin: 0 0 8px;
  font-size: 1.6rem;
  color: #065f46;
  text-align: center;
}
h2 {
  font-family: "Gayathri", Calibri, Arial, sans-serif;
  margin: 0 0 12px;
  font-size: 1.2rem;
  color: #065f46;
  text-align: center;
}
.explanation {
  font-size: 1.05rem;
  line-height: 1.8;
  color: #333;
  text-align: justify;
  margin-bottom: 0.8rem;
}

.explanation.highlight {
  background: #e8f5e9;
  padding: 12px 16px;
  border-radius: 8px;
  border-left: 4px solid #1b5e20;
  font-weight: 600;
  color: #1b5e20;
  text-align: center;
}

.subtitle {
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 16px;
}


/* =========================
   Participant Counter
   ========================= */
.counter-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: linear-gradient(135deg, #065f46 0%, #047857 100%);
  color: #fff;
  border-radius: 14px;
  padding: 16px 12px;
  margin-bottom: 20px;
  gap: 4px;
}
.counter-number {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.1;
}
.counter-label {
  font-size: 0.95rem;
  opacity: 0.9;
}
.counter-votes {
  font-size: 0.85rem;
  opacity: 0.8;
  margin-top: 2px;
}
.counter-votes:empty {
  display: none;
}

/* =========================
   Form
   ========================= */
form label {
  display: block;
  margin: 14px 0 6px;
  font-weight: 700;
  font-size: 1rem;
}
form input[type="text"],
form input[type="number"],
form select {
  width: 100%;
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 1.05rem;
  font-family: inherit;
  background: #f9fafb;
  transition: border-color 0.2s;
}
form input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
}
form input[type="file"] {
  width: 100%;
  padding: 12px;
  border: 2px dashed var(--border);
  border-radius: 10px;
  font-family: inherit;
  background: #f0fdf4;
  cursor: pointer;
  font-size: 0.95rem;
}
/* Error text */
.error-msg {
  color: #d32f2f;
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 6px;
  display: block;
  min-height: 0;
}
.error-msg:empty {
  display: none;
}
.error-msg:not(:empty) {
  display: block !important;
  padding: 6px 10px;
  background: #fff0f0;
  border-radius: 6px;
  border-left: 3px solid #d32f2f;
}

/* =========================
   Buttons
   ========================= */
button,
.btn-download {
  font-family: "Gayathri", Calibri, Arial, sans-serif;
}
.photo-options {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}
.btn-photo {
  flex: 1;
  padding: 14px 10px;
  border: 2px dashed var(--primary);
  border-radius: 12px;
  background: rgba(27, 94, 32, 0.06);
  color: var(--primary);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.btn-photo:hover,
.btn-photo:active {
  background: rgba(27, 94, 32, 0.15);
  border-color: var(--primary-hover);
}
#btnGenerate {
  margin-top: 20px;
  padding: 16px;
  border: none;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-size: 1.15rem;
  font-weight: 700;
  width: 100%;
  transition: background 0.2s ease, transform 0.1s;
}
#btnGenerate:hover {
  background: var(--primary-hover);
}
#btnGenerate:active {
  transform: scale(0.98);
}
#btnGenerate:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-download {
  display: block;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
  padding: 14px;
  border-radius: 10px;
  text-align: center;
  margin-top: 12px;
  transition: background 0.2s ease;
  width: 100%;
}
.btn-download:hover {
  background: var(--primary-hover);
}

.btn-reset {
  margin-top: 20px;
  padding: 14px;
  border: 2px solid var(--primary);
  border-radius: 10px;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
  width: 100%;
}
.btn-reset:hover {
  background: #ecfdf5;
}

/* =========================
   Poster Preview
   ========================= */
canvas {
  max-width: 100%;
  height: auto;
  border: 1px solid #ddd;
  border-radius: 8px;
  margin-top: 12px;
  display: block;
}

/* Poster Tabs */
.poster-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 4px;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--primary);
}
.tab-btn {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 0;
  background: #fff;
  color: var(--primary);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin: 0;
  transition: background 0.2s, color 0.2s;
}
.tab-btn.active {
  background: var(--primary);
  color: #fff;
}
.tab-btn:hover:not(.active) {
  background: #ecfdf5;
}
.poster-tab-content {
  display: none;
}
.poster-tab-content.active {
  display: block;
}
.poster-actions {
  margin-top: 8px;
}

/* =========================
   Share Buttons
   ========================= */
.share-section {
  margin-top: 20px;
  text-align: center;
}
.share-label {
  font-weight: 700;
  margin-bottom: 10px;
  font-size: 1rem;
  color: #374151;
}
.share-buttons {
  display: flex;
  gap: 10px;
}
.share-btn {
  flex: 1;
  padding: 12px 8px;
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  margin: 0;
}
.whatsapp-btn {
  background: #25d366;
}
.whatsapp-btn:hover {
  background: #1da851;
}
.facebook-btn {
  background: #1877f2;
}
.facebook-btn:hover {
  background: #1565c0;
}
.general-btn {
  background: #6b7280;
}
.general-btn:hover {
  background: #4b5563;
}

/* =========================
   Status line
   ========================= */
#photoStatus {
  margin-top: 6px;
  font-size: 0.9rem;
  color: var(--muted);
}

/* =========================
   Modal
   ========================= */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  justify-content: center;
  align-items: center;
  z-index: 999;
}
.modal:not([hidden]) {
  display: flex;
}
.modal-content {
  background: #fff;
  padding: 20px;
  border-radius: 14px;
  max-width: 95%;
  max-height: 90%;
  text-align: center;
  width: 100%;
}
.modal img {
  max-width: 100%;
  max-height: 65vh;
  display: block;
  margin: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.modal-buttons {
  margin-top: 14px;
  display: flex;
  gap: 12px;
}
#cropCancel {
  flex: 1;
  background: var(--danger);
  color: #fff;
  padding: 12px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
}
#cropCancel:hover {
  background: #b91c1c;
}
#cropOk {
  flex: 1;
  background: var(--success);
  color: #fff;
  padding: 12px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
}
#cropOk:hover {
  background: #047857;
}

/* =========================
   Form Message
   ========================= */
#formMsg {
  text-align: center;
  font-size: 0.95rem;
  margin-top: 12px;
  color: var(--text);
}

/* =========================
   Responsive
   ========================= */
@media (max-width: 520px) {
  .container {
    margin: 8px;
    padding: 14px 12px;
    border-radius: 12px;
  }
  h1 {
    font-size: 1.3rem;
  }
  #btnGenerate {
    font-size: 1.05rem;
    padding: 14px;
  }
  .share-buttons {
    flex-direction: column;
  }
  .share-btn {
    padding: 14px;
    font-size: 1rem;
  }
}
