/* Engagement module: rewards, progress posts, gallery, announcement responses, surveys, certificates. */

.en-wrap { flex-wrap: wrap; }
@media (max-width: 600px) { .en-hide-sm { display: none; } }
.en-inline { display: inline; }
.en-clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.btn.on { background: var(--info-bg); border-color: #b9d3f0; color: var(--info); }

/* leaderboard: single series, plain HTML bars */
.en-board { list-style: none; margin: 0 0 8px; padding: 0; }
.en-board li { display: grid; grid-template-columns: 30px minmax(0, 1.4fr) minmax(40px, 1fr) 64px; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid #eef1ef; font-size: .9rem; }
.en-board li:last-child { border-bottom: 0; }
.en-rank { text-align: center; font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.en-who { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.en-who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.en-who a { color: var(--ink); }
.en-track { display: block; height: 10px; background: var(--track); border-radius: 0 4px 4px 0; overflow: hidden; }
.en-track > span { display: block; height: 100%; background: #2a78d6; border-radius: 0 4px 4px 0; }
.en-pts { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink); }
@media (max-width: 420px) { .en-board li { grid-template-columns: 26px minmax(0, 1fr) 60px; } .en-board .en-track { grid-column: 2 / 4; grid-row: 2; height: 6px; } }

.en-seg { display: inline-flex; border: 1px solid #cfd6d3; border-radius: 9px; overflow: hidden; margin-bottom: 10px; }
.en-seg a { padding: 6px 12px; font-size: .84rem; font-weight: 600; color: var(--ink-2); }
.en-seg a + a { border-left: 1px solid #cfd6d3; }
.en-seg a.on { background: var(--brand-2); color: #fff; }
.en-seg a:hover { text-decoration: none; }

.en-roster { border: 1px solid var(--line); border-radius: 10px; padding: 4px 12px; max-height: 380px; overflow-y: auto; }
.en-roster > label, .en-roster-row { padding: 8px 0; border-bottom: 1px solid #eef1ef; }
.en-roster-row { display: flex; align-items: center; gap: 10px; }
.en-roster-row:last-child { border-bottom: 0; }
.en-roster label.check { font-weight: 500; color: var(--ink); }
.en-all { position: sticky; top: 0; background: #fff; z-index: 1; }
.en-attn { border-left: 4px solid var(--accent); }
.en-tiles { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.en-quick { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.en-quick label { flex: 1 1 200px; }

.en-inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; width: 100%; }
.en-inline-form input, .en-inline-form select { width: auto; min-width: 0; }
.en-inline-form .en-grow { flex: 1 1 160px; }
.en-inline-form .en-num { width: 84px; flex: none; }
.en-inline-form label:not(.check) { flex: 1 1 200px; }
.en-inline-form label:not(.check) select, .en-inline-form label:not(.check) input { width: 100%; }
.en-meta { flex-basis: 100%; }
.en-new { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.en-setting { display: flex; gap: 6px 14px; align-items: center; flex-wrap: wrap; }

/* progress posts */
.en-post h3 { margin: 4px 0; }
.en-post p { margin: .3rem 0 .6rem; }
.en-post-photo { display: block; margin: -18px -18px 12px; }
.en-post-photo img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: var(--r) var(--r) 0 0; }
.en-react { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.en-feed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; align-items: start; margin-bottom: 16px; }
.en-feed-grid > .card { margin: 0; }
.en-feed { max-width: 100%; }
.en-listhead { margin-bottom: 4px; }

/* gallery */
.en-albums { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.en-album { display: flex; flex-direction: column; gap: 4px; color: var(--ink); margin: 0; padding: 0 0 14px; overflow: hidden; }
.en-album > :not(.en-cover) { margin: 0 14px; }
.en-album .badge { align-self: flex-start; }
.en-album:hover { text-decoration: none; border-color: #c9d2cf; }
.en-cover { display: block; aspect-ratio: 3 / 2; background: var(--track); margin-bottom: 8px; }
.en-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.en-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.en-photo { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.en-photo img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.en-photo figcaption { padding: 8px 12px; font-size: .86rem; display: flex; justify-content: space-between; gap: 8px; align-items: center; }

/* announcements & home asks */
.en-progress { margin: 12px 0 8px; }
.en-progress .meter span { background: #2a78d6; }
.en-ann-form { margin: 12px 0 0; padding-top: 12px; border-top: 1px solid #eef1ef; align-items: flex-end; }
.en-ask { border-left: 4px solid var(--info); }
.en-ask h3 { margin: 6px 0 2px; }
.en-ask-survey { border-left-color: var(--good); }
.en-choice-row { display: flex; gap: 8px; flex-wrap: wrap; }
.en-choice-row .chip { cursor: pointer; }
.en-choice-row .chip:has(input:checked) { background: var(--brand-2); color: #fff; }
.en-home { margin-bottom: 8px; }
.en-kidpts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.en-kidpt { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); }
.en-kidpt:hover { text-decoration: none; border-color: #c9d2cf; }
.en-big { font-size: 1.5rem; font-weight: 800; color: #2a78d6; line-height: 1.2; }
.en-big small { font-size: .8rem; color: var(--muted); font-weight: 600; }
.en-child-pts { display: flex; gap: 12px; align-items: center; color: var(--ink); }
.en-child-pts:hover { text-decoration: none; border-color: #c9d2cf; }
.en-star { width: 40px; height: 40px; border-radius: 50%; background: #fdf1dc; color: #c27a00; display: grid; place-items: center; font-size: 1.3rem; flex: none; }
.en-child { margin-bottom: 16px; }

/* surveys */
.en-survey-card { display: block; color: var(--ink); }
.en-survey-card:hover { text-decoration: none; border-color: #c9d2cf; }
.en-q { border: 1px dashed var(--line); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.en-q-head { display: flex; gap: 8px; flex-wrap: wrap; }
.en-q-head select { width: auto; flex: 0 0 auto; }
.en-q-head input { flex: 1 1 180px; width: auto; min-width: 0; }
.en-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.en-results > .card { margin: 0; }
@media (max-width: 420px) { .en-results { grid-template-columns: minmax(0, 1fr); } }
.en-avg { font-size: 1.05rem; color: var(--ink); }
.en-bars { display: flex; flex-direction: column; gap: 8px; }
.en-bar-row { display: grid; grid-template-columns: minmax(70px, 34%) minmax(0, 1fr) 64px; align-items: center; gap: 10px; font-size: .86rem; color: var(--ink); }
.en-bar-label { overflow-wrap: anywhere; }
.en-bar-row .en-track { height: 16px; }
.en-bar-val { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.en-scale { display: flex; gap: 8px; }
.en-scale label { flex: 1; }
.en-scale input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.en-scale span { display: grid; place-items: center; height: 44px; border: 1px solid #cfd6d3; border-radius: 10px; font-weight: 700; color: var(--ink); cursor: pointer; background: #fff; }
.en-scale input:checked + span { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.en-scale input:focus-visible + span { outline: 2px solid #8cc7c1; outline-offset: 1px; }
.en-scale-ends { margin-top: 4px; }
.en-choices label.check { font-weight: 500; color: var(--ink); }
.en-survey-form fieldset { padding-bottom: 6px; }

/* certificates: admin & parent lists */
.en-templates { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-bottom: 16px; }
.en-tpl { margin: 0; display: flex; flex-direction: column; gap: 4px; border-top: 5px solid var(--en-accent, var(--brand)); color: var(--ink); }
a.en-tpl:hover { text-decoration: none; border-color: #c9d2cf; border-top-color: var(--en-accent); }
.en-tpl .row { margin-top: 6px; }
.en-pick { display: flex; flex-direction: column; gap: 12px; }
.en-pick fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.en-pick legend { padding: 0 4px; margin: 0; }
.en-pick-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px 12px; }
.en-pick-list label { font-weight: 500; color: var(--ink); }

/* the certificate sheet: A4 landscape, scales with its container */
.en-cert-page { background: #e7ebe9; min-height: 100vh; }
.en-cert-bar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; max-width: 1100px; margin: 0 auto; padding: 14px 12px; }
.en-cert-wrap { container-type: inline-size; max-width: 1100px; margin: 0 auto 24px; padding: 0 12px; }
.en-cert { position: relative; aspect-ratio: 297 / 210; background: #fffdf8; color: #1d2a28; box-shadow: 0 4px 18px rgba(0, 0, 0, .12); overflow: hidden;
  font-family: Georgia, "Times New Roman", "Noto Serif", serif; font-size: 1.45cqi; }
.en-cert h1, .en-cert p { margin: 0; }
.en-cert-inner { position: absolute; inset: 5%; display: flex; flex-direction: column; align-items: center; justify-content: space-between; text-align: center; padding: 3% 6% 2%; }
.en-cert-head { display: flex; align-items: center; gap: .6em; font-family: system-ui, sans-serif; text-transform: uppercase; letter-spacing: .22em; font-size: .85em; font-weight: 700; color: var(--en-accent); }
.en-cert-head img { width: 2.6em; height: 2.6em; }
.en-cert-title { font-size: 3.3em; line-height: 1.1; color: var(--en-accent); letter-spacing: .01em; }
.en-cert-pre { font-style: italic; color: #5b6563; font-size: 1.05em; }
.en-cert-name { font-size: 3em; font-style: italic; line-height: 1.15; padding: 0 1.2em .1em; border-bottom: .08em solid color-mix(in srgb, var(--en-accent) 55%, #fff); }
.en-cert-body { font-size: 1.15em; line-height: 1.55; max-width: 78%; color: #2c3836; }
.en-cert-foot { display: grid; grid-template-columns: 1fr auto 1fr; gap: 6%; align-items: end; width: 80%; }
.en-cert-foot > div:not(.en-seal) { display: flex; flex-direction: column; gap: .3em; }
.en-sig { font-style: italic; font-size: 1.15em; border-bottom: .06em solid #9aa29f; padding-bottom: .25em; }
.en-cert-foot small { font-family: system-ui, sans-serif; font-size: .7em; text-transform: uppercase; letter-spacing: .14em; color: #6b7674; }
.en-seal { width: 2.6em; height: 2.6em; border-radius: 50%; display: grid; place-items: center; font-size: 2.2em; color: #fff;
  background: radial-gradient(circle, var(--en-accent) 55%, color-mix(in srgb, var(--en-accent) 70%, #000) 56% 60%, var(--en-accent) 61%);
  box-shadow: 0 0 0 .25em color-mix(in srgb, var(--en-accent) 25%, #fff); }
.en-cert-serial { font-family: system-ui, sans-serif; font-size: .62em; color: #8a9391; }
.en-rib { display: none; }
/* border styles */
.en-b-classic::before { content: ""; position: absolute; inset: 2.6%; border: .45em solid var(--en-accent); }
.en-b-classic .en-cert-inner { border: .12em solid var(--en-accent); }
.en-b-ribbon .en-cert-inner { border: .15em solid color-mix(in srgb, var(--en-accent) 45%, #fff); }
.en-b-ribbon .en-rib { display: block; position: absolute; width: 20%; aspect-ratio: 1; }
.en-b-ribbon .en-rib-a { top: 0; left: 0; background: linear-gradient(135deg, var(--en-accent) 0 38%, color-mix(in srgb, var(--en-accent) 35%, #fff) 38% 46%, transparent 46%); }
.en-b-ribbon .en-rib-b { bottom: 0; right: 0; background: linear-gradient(315deg, var(--en-accent) 0 38%, color-mix(in srgb, var(--en-accent) 35%, #fff) 38% 46%, transparent 46%); }
.en-b-modern::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 7%; background: linear-gradient(var(--en-accent), color-mix(in srgb, var(--en-accent) 60%, #000)); }
.en-b-modern::after { content: ""; position: absolute; left: 7%; top: 0; bottom: 0; width: .6%; background: color-mix(in srgb, var(--en-accent) 30%, #fff); }
.en-b-modern .en-cert-inner { left: 11%; }

@page en-cert { size: A4 landscape; margin: 0; }
@media print {
  .en-cert-page { background: #fff; }
  .en-cert-wrap { max-width: none; width: 297mm; padding: 0; margin: 0; page: en-cert; }
  .en-cert { width: 297mm; height: 209mm; aspect-ratio: auto; box-shadow: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
