:root {
  --navy: #1d3a7a;
  --navy-dark: #142b5c;
  --saffron: #f58220;
  --green: #1f9a48;
  --paper: #f0ede6;
  --card: #eeebe4;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { -webkit-tap-highlight-color: transparent; }

html { background: #142b5c; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: "Noto Sans", system-ui, sans-serif;
  color: var(--navy);
  background: linear-gradient(160deg, #2a4f8f 0%, #1d3a7a 45%, #142b5c 100%) fixed;
  padding: 16px 12px calc(24px + env(safe-area-inset-bottom));
  overflow-x: hidden;
}

/* ---- App card ----------------------------------------------------------- */
.app {
  position: relative;
  z-index: 1;
  max-width: 460px;
  margin: 0 auto;
  background: var(--card);
  border-radius: 26px;
  padding: 18px 18px 22px;
  box-shadow: 0 30px 60px rgba(6, 18, 45, .45);
  overflow: hidden;
}

/* ---- Stepper ------------------------------------------------------------ */
.stepper {
  display: flex;
  justify-content: space-between;
  list-style: none;
  padding: 0;
  margin: 6px 0 18px;
  position: relative;
}
.stepper::before {
  content: "";
  position: absolute;
  left: 16%; right: 16%; top: 15px;
  height: 2px;
  background: linear-gradient(90deg, var(--saffron), #d6d2c8 50%, var(--green));
  opacity: .5;
}
.stepper li {
  position: relative;
  flex: 1;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #8b93a7;
  transition: color .3s var(--ease);
}
.stepper li span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin: 0 auto 4px;
  border-radius: 50%;
  background: var(--card);
  border: 2px solid #c9cfdb;
  font-size: 14px;
  transition: all .35s var(--ease);
}
.stepper li.active { color: var(--navy); }
.stepper li.active span { background: var(--navy); border-color: var(--navy); color: #fff; transform: scale(1.08); }
.stepper li.done span { background: var(--green); border-color: var(--green); color: #fff; }

/* ---- Steps -------------------------------------------------------------- */
.step { display: none; }
.step.active { display: block; animation: stepIn .5s var(--ease) both; }
@keyframes stepIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---- Camera ------------------------------------------------------------- */
.cam-stage {
  position: relative;
  aspect-ratio: 805 / 760; /* matches the certificate photo window */
  border-radius: 18px;
  overflow: hidden;
  background: radial-gradient(circle at 50% 40%, #e4e2dc, #cfccc4);
  box-shadow: inset 0 0 0 1px rgba(29,58,122,.08), 0 10px 24px rgba(20,43,92,.15);
}
.cam-stage video,
.cam-stage img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .4s var(--ease);
}
.cam-stage video { transform: scaleX(-1); }

.cam-idle {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
  color: var(--navy);
}
.cam-idle svg { opacity: .8; }
.cam-idle p { margin: 0; max-width: 260px; font-size: 15px; color: #4a5878; }

.cam-guide {
  position: absolute;
  left: 50%; top: 46%;
  width: 52%; height: 72%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 3px dashed rgba(255,255,255,.85);
  box-shadow: 0 0 0 2000px rgba(13, 27, 58, .28);
  opacity: 0;
  transition: opacity .4s var(--ease);
  pointer-events: none;
}

.cam-count {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: "Permanent Marker", cursive;
  font-size: 120px;
  color: #fff;
  text-shadow: 0 6px 24px rgba(0,0,0,.35);
  pointer-events: none;
}
.cam-count.pop { animation: pop .8s var(--ease); }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 30% { transform: scale(1.1); opacity: 1; } 100% { transform: scale(1); opacity: 0; } }

.cam-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.cam-flash.go { animation: flash .5s ease-out; }
@keyframes flash { from { opacity: .95; } to { opacity: 0; } }

#step1[data-mode="live"] video,
#step1[data-mode="live"] .cam-guide,
#step1[data-mode="shot"] img { opacity: 1; }
#step1:not([data-mode="idle"]) .cam-idle { display: none; }

.cam-actions { display: none; margin-top: 18px; }
#step1[data-mode="live"] .cam-actions--live { display: flex; flex-direction: column; align-items: center; gap: 6px; }
#step1[data-mode="shot"] .cam-actions--shot { display: flex; gap: 10px; }
.cam-actions--shot .btn-pill { flex: 1; }
.hint { margin: 0; font-size: 13px; color: #6b7590; }

.shutter {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  border: 4px solid var(--navy);
  background: #fff;
  padding: 5px;
  cursor: pointer;
  transition: transform .15s var(--ease);
  box-shadow: 0 8px 20px rgba(20,43,92,.25);
}
.shutter span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffa45a, var(--saffron) 60%, #d96a0c);
}
.shutter:active { transform: scale(.9); }
.shutter:disabled { opacity: .5; }

/* ---- Pledge ------------------------------------------------------------- */
.pledge-paper {
  position: relative;
  background: var(--paper);
  border-radius: 4px 4px 16px 16px;
  padding: 54px 18px 22px;
  margin-top: 54px;
  text-align: center;
  box-shadow: 0 -4px 14px rgba(0,0,0,.08);
}
.pledge-paper::before {
  /* torn top edge */
  content: "";
  position: absolute;
  left: 0; right: 0; top: -14px;
  height: 16px;
  background: var(--paper);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 16' preserveAspectRatio='none'%3E%3Cpath d='M0 9 12 4 22 10 35 3 47 8 58 2 70 9 84 5 95 11 108 3 121 8 133 1 146 7 160 4 171 10 185 2 197 8 211 5 224 11 236 3 249 9 262 4 275 10 288 2 301 7 315 3 327 10 340 5 353 11 366 4 379 8 391 3 400 7V16H0Z'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 16' preserveAspectRatio='none'%3E%3Cpath d='M0 9 12 4 22 10 35 3 47 8 58 2 70 9 84 5 95 11 108 3 121 8 133 1 146 7 160 4 171 10 185 2 197 8 211 5 224 11 236 3 249 9 262 4 275 10 288 2 301 7 315 3 327 10 340 5 353 11 366 4 379 8 391 3 400 7V16H0Z'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
}
.pledge-thumb {
  position: absolute;
  left: 50%; top: -48px;
  width: 92px; height: 92px;
  transform: translateX(-50%);
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid #fff;
  box-shadow: 0 0 0 3px var(--saffron), 0 8px 18px rgba(20,43,92,.25);
  background: #ddd;
}
.pledge-thumb:not([src]) { visibility: hidden; }
.pledge-line {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--navy);
}
.pledge-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 12px auto;
}
.pledge-divider::before,
.pledge-divider::after { content: ""; width: 64px; height: 2px; background: var(--saffron); }
.pledge-divider::after { background: var(--green); }
.pledge-divider .js-chakra { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #dbe4f3; }

.agree {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 2px 16px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #fff;
  border: 2px solid #dfe3ec;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  transition: border-color .25s var(--ease), background .25s var(--ease);
}
.agree input { position: absolute; opacity: 0; pointer-events: none; }
.agree-box {
  flex-shrink: 0;
  width: 26px; height: 26px;
  border-radius: 8px;
  border: 2px solid #b6bfd2;
  display: grid;
  place-items: center;
  transition: all .25s var(--ease);
}
.agree-box::after {
  content: "";
  width: 7px; height: 13px;
  border: solid #fff;
  border-width: 0 3px 3px 0;
  transform: rotate(45deg) scale(0);
  margin-top: -3px;
  transition: transform .25s var(--ease);
}
.agree input:checked + .agree-box { background: var(--green); border-color: var(--green); }
.agree input:checked + .agree-box::after { transform: rotate(45deg) scale(1); }
.agree:has(input:checked) { border-color: var(--green); background: #f3fbf5; }
.agree input:focus-visible + .agree-box { outline: 3px solid rgba(29,58,122,.35); outline-offset: 2px; }

#turnstile:not(:empty) { margin-bottom: 14px; }

/* ---- Buttons ------------------------------------------------------------ */
.btn-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid transparent;
  border-radius: 999px;
  padding: 13px 20px;
  white-space: nowrap;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: .01em;
  cursor: pointer;
  transition: transform .15s var(--ease), box-shadow .25s var(--ease), background .25s var(--ease), opacity .25s;
}
.btn-pill:active { transform: scale(.97); }
.btn-saffron {
  background: linear-gradient(180deg, #ff9a3d, var(--saffron));
  color: #fff;
  box-shadow: 0 8px 18px rgba(245,130,32,.35);
}
.btn-saffron:hover { box-shadow: 0 10px 24px rgba(245,130,32,.45); }
.btn-saffron:disabled { opacity: .45; box-shadow: none; cursor: not-allowed; }
.btn-navy { background: var(--navy); color: #fff; box-shadow: 0 8px 18px rgba(29,58,122,.3); }
.btn-outline-navy { background: transparent; color: var(--navy); border-color: var(--navy); }
.btn-text {
  display: block;
  margin: 14px auto 0;
  background: none;
  border: 0;
  color: var(--navy);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  opacity: .75;
  text-align: center;
}
.btn-text:hover { opacity: 1; color: var(--navy); }

/* ---- Certificate -------------------------------------------------------- */
#step3 { text-align: center; }
.cert-msg { font-weight: 700; margin-bottom: 12px; }
.cert-canvas {
  width: 100%;
  height: auto;
  border-radius: 14px;
  box-shadow: 0 16px 36px rgba(20,43,92,.3);
}
.cert-actions { display: flex; gap: 10px; margin-top: 16px; }
.cert-actions .btn-pill { flex: 1; }

.privacy { margin: 18px 0 0; text-align: center; font-size: 12px; color: #7a839a; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ======================= Ekta Nagar theme ================================ */
:root {
  --navy: #0f1b33;
  --navy-dark: #0a1325;
  --saffron: #ff9800;
  --saffron-end: #f4511e;
  --green: #0fb5a0;      /* teal accent (was green) */
  --teal-dark: #0a8f7f;
  --paper: #f1f7f8;
  --card: #ffffff;
  --cream: #fff8dc;
}
html { background: linear-gradient(180deg, #0f1b33 0%, #173a4d 55%, #0f1b33 100%) fixed; }
body {
  font-family: "Inter", system-ui, sans-serif;
  background: none;
  padding: 0 12px calc(24px + env(safe-area-inset-bottom));
}
.top-bar { height: 6px; margin: 0 -12px; background: linear-gradient(90deg, #f0b429, #e11d48 50%, #a855f7); }
.site-nav {
  display: flex; align-items: center; gap: 12px;
  max-width: 460px; margin: 0 auto; padding: 14px 4px;
}
.nav-logo { width: 52px; height: 52px; object-fit: contain; background: #fff; border-radius: 14px; padding: 4px; }
.nav-title { font-family: "Playfair Display", Georgia, serif; font-weight: 700; color: #fff; font-size: 1.25rem; line-height: 1.1; }
.nav-sub { color: var(--green); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; }

.app { border-radius: 24px; box-shadow: 0 24px 50px rgba(0, 0, 0, .4); }
.hero { text-align: center; padding: 6px 0 14px; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 999px;
  border: 1px solid #d5e5e8; background: #f1f7f8;
  color: var(--navy); font-size: 12.5px; font-weight: 500;
}
.hero-badge i { width: 8px; height: 8px; border-radius: 50%; background: var(--saffron); }
.hero-title {
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 700; font-size: clamp(1.7rem, 8vw, 2.2rem);
  color: var(--navy); margin: 12px 0 6px;
}
.hero-title span { color: var(--saffron); }
.hero-sub { margin: 0; color: #4a5878; font-size: 14px; }

.stepper::before { background: linear-gradient(90deg, var(--saffron), #d6e5e8 50%, var(--green)); }
.stepper li.active span { background: linear-gradient(135deg, var(--green), var(--teal-dark)); border-color: var(--green); }
.stepper li.done span { background: var(--teal-dark); border-color: var(--teal-dark); }
.stepper li.active { color: var(--navy); }

.cam-stage { background: radial-gradient(circle at 50% 40%, #e6f0f2, #c9dce0); }
.cam-count { font-family: "Playfair Display", Georgia, serif; font-weight: 700; }
.shutter { border-color: var(--green); }
.shutter span { background: radial-gradient(circle at 35% 30%, #ffb74d, var(--saffron) 60%, var(--saffron-end)); }

.pledge-paper { background: var(--paper); border: 1px solid #d5e5e8; }
.pledge-line { font-weight: 500; }
.pledge-divider::before { background: var(--saffron); }
.pledge-divider::after { background: var(--green); }
.pledge-divider .js-chakra { background: #d5e5e8; }

.btn-pill { background-origin: border-box; }
.btn-saffron { background: linear-gradient(90deg, var(--saffron), var(--saffron-end)); background-origin: border-box; box-shadow: 0 8px 18px rgba(244, 81, 30, .3); }
.btn-saffron:hover { box-shadow: 0 10px 24px rgba(244, 81, 30, .4); }
.btn-navy { background: linear-gradient(90deg, var(--green), var(--teal-dark)); box-shadow: 0 8px 18px rgba(15, 181, 160, .3); }
.btn-outline-navy { color: var(--teal-dark); border-color: var(--green); }
.btn-text, .btn-text:hover { color: var(--teal-dark); }
.agree:has(input:checked) { border-color: var(--green); background: #f1fbf9; }
.agree input:focus-visible + .agree-box { outline-color: rgba(15, 181, 160, .45); }
.cert-msg { font-family: "Playfair Display", Georgia, serif; font-size: 1.15rem; color: var(--navy); }

/* ---- Name field --------------------------------------------------------- */
.name-label { display: block; margin: 18px 2px 6px; font-size: 14px; font-weight: 600; color: var(--navy); }
.name-input { border-radius: 12px; padding: 12px 14px; font-size: 16px; }

/* Hidden video/photo layers must not swallow taps meant for "Open Camera". */
.cam-stage video, .cam-stage img { pointer-events: none; }
.cam-idle { z-index: 2; }
