:root {
  --green: #14452f;
  --green-2: #1f6b48;
  --red: #a4161a;
  --gold: #c9a227;
  --ink: #1a1a2e;
  --muted: #5b6170;
  --line: #d6d9df;
  --bg: #f6f3ee;
  --card: #fff;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 18px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.hero {
  background: var(--green);
  color: #fff;
  text-align: center;
  padding: 28px 20px 24px;
  padding-top: max(28px, env(safe-area-inset-top));
  border-bottom: 4px solid var(--gold);
}
.church { margin: 0 0 6px; font-size: 18px; font-weight: 600; }
h1 { margin: 0; font-size: 26px; line-height: 1.2; }
.langs {
  display: flex; max-width: 360px; margin: 0 auto 18px;
  border: 2px solid #fff; border-radius: 999px; overflow: hidden;
}
.langs button {
  flex: 1; min-height: 50px; border: 0; cursor: pointer;
  font: inherit; font-size: 19px; font-weight: 700; color: #fff; background: transparent;
}
.langs button[aria-pressed="true"] { background: #fff; color: var(--green); }
.note:empty { display: none; }
h2 { margin: 0 0 8px; font-size: 24px; color: var(--green); }

main { max-width: 560px; margin: 0 auto; padding: 20px 16px 48px; }
.lead { margin: 4px 0 20px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin: 0 0 16px;
  min-width: 0;
  position: relative;
}
legend { float: left; width: 100%; padding: 0; margin: 0 0 8px; font-weight: 700; font-size: 20px; color: var(--green); }
legend + * { clear: left; }
fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }

.field { display: block; margin: 0 0 14px; }
.field > span { display: block; font-weight: 600; margin-bottom: 4px; }
input, select, textarea {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  font: inherit;
  color: inherit;
  background: #fff;
  border: 1px solid #9aa0ab;
  border-radius: 8px;
}
input[type="date"] { -webkit-appearance: none; appearance: none; text-align: left; }
input[type="date"]::-webkit-date-and-time-value { text-align: left; }
input:focus, select:focus, textarea:focus, .waiver:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 1px;
}

.check { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; margin: 0 0 14px; min-height: 44px; cursor: pointer; }
.check input { width: 28px; height: 28px; min-height: 0; margin: 2px 0 0; flex: none; accent-color: var(--green); }
.check span { flex: 1; padding-top: 2px; }
.check .err { flex-basis: 100%; }

button, .big {
  font: inherit;
  border-radius: 10px;
  cursor: pointer;
}
.big {
  display: block;
  width: 100%;
  min-height: 56px;
  padding: 14px 16px;
  margin: 0 0 14px;
  border: 0;
  background: var(--green);
  color: #fff;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}
.big.alt { background: var(--red); }
.big:disabled { opacity: .6; cursor: wait; }
.telegram { background: #229ed9; }
.big.share { background: #fff; color: #1a6f99; border: 2px solid #229ed9; }
.qr { text-align: center; }
.qr h3 { margin: 0 0 12px; font-size: 20px; color: var(--green); }
.qr img { display: block; width: 100%; max-width: 280px; margin: 0 auto 8px; image-rendering: pixelated; }
.qr .big { margin-bottom: 0; }
.note input { margin-top: 6px; }

.back, .add, .clear {
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--green);
  font-weight: 600;
}
.back { margin: 0 0 14px; border: 0; background: none; padding-left: 0; }
.add { display: block; width: 100%; margin: 0 0 16px; border: 2px dashed var(--green-2); }
.clear { margin-top: 8px; }
.remove {
  position: absolute; top: 8px; right: 8px;
  width: 44px; height: 44px;
  border: 0; background: none; color: var(--muted); font-size: 22px;
}
.hint { margin: -6px 0 0; font-size: 15px; color: var(--muted); }

.waiver {
  max-height: 260px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 14px;
  margin: 0 0 14px;
  background: #fbfaf7;
  font-size: 16px;
}
.waiver h3 { font-size: 17px; margin: 12px 0 4px; }
.waiver p { margin: 8px 0; }

#sig {
  display: block;
  width: 100%;
  height: 160px;
  border: 2px dashed #9aa0ab;
  border-radius: 8px;
  background: #fff;
  touch-action: none;
  cursor: crosshair;
}

.err {
  margin: 6px 0 0;
  color: var(--red);
  font-weight: 600;
  font-size: 16px;
}
#top-err .err { margin: 0 0 14px; padding: 12px; background: #fdecec; border-radius: 8px; }

#carolers { margin: 0; padding-left: 22px; }
.note { margin: 0 0 14px; }
.note.warn { padding: 12px; background: #fff7df; border: 1px solid #ecd58a; border-radius: 8px; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.row { display: flex; gap: 12px; clear: left; }
.row > .field { flex: 1; min-width: 0; }
.sub { margin: 18px 0 10px; font-size: 18px; color: var(--green); }
.flag { display: inline-block; vertical-align: -3px; margin-right: 8px; border-radius: 3px; box-shadow: 0 0 0 1px rgba(0,0,0,.25); }
#add-emergency { margin-top: 10px; }
input::placeholder, textarea::placeholder { color: #9a9a9a; }
textarea { resize: vertical; font: inherit; }
.phone { display: flex; gap: 6px; }
.phone .cc { flex: 0 0 auto; width: auto; padding-right: 4px; }
.phone input { flex: 1; min-width: 0; }
.kid .hint { margin-bottom: 18px; }
.hint.esign { margin: 6px 0 16px; }
#sibling .hint { margin-bottom: 18px; }
.help-foot { margin-top: 14px; text-align: center; }
/* the church email is one 41-letter word: let it wrap on small phones */
.note, .hint, .lead, .err { overflow-wrap: anywhere; }
/* Van preference: a question, then two big Yes / No buttons */
.van > legend { float: none; font-size: inherit; font-weight: 600; color: inherit; margin: 0 0 6px; }
.yesno { display: flex; gap: 10px; margin: 0 0 14px; }
.yesno label { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; font-weight: 600; }
.yesno label:has(input:checked) { border-color: var(--green); background: #eaf3ee; }
.yesno input { width: 22px; height: 22px; min-height: 0; margin: 0; flex: none; accent-color: var(--green); }
.van textarea { max-height: 9.5em; overflow-y: auto; }  /* ~6 lines, then scroll */
