:root {
  --purple: #5b1675;
  --purple-2: #7b2b91;
  --pink: #f457b6;
  --pink-soft: #f5a7de;
  --mint: #70d9c0;
  --peach: #ffd28c;
  --orange: #f6a62d;
  --cream: #f6f1c6;
  --ink: #2b1733;
  --white: #fffdf9;
  --danger: #a81849;
  --shadow: 0 30px 80px rgba(66, 19, 83, 0.22);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: #f6eefa; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 15%, rgba(244, 87, 182, .28), transparent 34%),
    radial-gradient(circle at 85% 10%, rgba(112, 217, 192, .32), transparent 32%),
    radial-gradient(circle at 80% 90%, rgba(255, 210, 140, .42), transparent 40%),
    linear-gradient(145deg, #fff8ef 0%, #f8edf8 55%, #eefbf8 100%);
  overflow-x: hidden;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.ambient {
  position: fixed;
  border-radius: 999px;
  filter: blur(50px);
  opacity: .45;
  pointer-events: none;
  animation: drift 9s ease-in-out infinite alternate;
}
.ambient-a { width: 260px; height: 260px; background: var(--pink); left: -90px; top: 18%; }
.ambient-b { width: 300px; height: 300px; background: var(--mint); right: -110px; top: 5%; animation-delay: -3s; }
.ambient-c { width: 280px; height: 280px; background: var(--peach); right: 8%; bottom: -100px; animation-delay: -6s; }
@keyframes drift { to { transform: translate3d(18px, -18px, 0) scale(1.08); } }

.app-shell { width: min(100%, 760px); margin: 0 auto; padding: 16px 16px calc(28px + env(safe-area-inset-bottom)); position: relative; z-index: 1; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 2px 18px; }
.wordmark { color: var(--purple); font-weight: 950; letter-spacing: .12em; text-decoration: none; font-size: .82rem; }
.unofficial-pill { font-size: .64rem; font-weight: 850; letter-spacing: .08em; color: var(--purple); border: 1px solid rgba(91,22,117,.25); background: rgba(255,255,255,.52); border-radius: 999px; padding: 7px 9px; }

.screen { display: none; min-height: calc(100vh - 74px); align-items: center; justify-content: center; animation: screenIn .44s cubic-bezier(.2,.8,.2,1); }
.screen.is-active { display: flex; }
@keyframes screenIn { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }

.glass {
  width: 100%;
  background: linear-gradient(145deg, rgba(255,255,255,.83), rgba(255,255,255,.62));
  border: 1px solid rgba(255,255,255,.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}
.hero-card, .camera-card, .form-card, .done-card, .loading-card { border-radius: 34px; padding: clamp(22px, 5vw, 40px); }
.hero-card { text-align: center; }
.eyebrow { color: var(--purple); font-size: .72rem; font-weight: 950; letter-spacing: .16em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(2.6rem, 9vw, 5rem); line-height: .91; letter-spacing: -.055em; margin: 13px 0 18px; }
h1 span { background: linear-gradient(90deg, var(--pink), var(--orange), var(--purple)); -webkit-background-clip: text; background-clip: text; color: transparent; }
h2 { font-size: clamp(2rem, 7vw, 3.5rem); line-height: .98; letter-spacing: -.045em; margin: 10px 0 14px; }
.lead { max-width: 530px; margin: 0 auto 20px; font-size: 1.05rem; line-height: 1.55; color: rgba(43,23,51,.76); }
.hero-art { width: 100%; border-radius: 24px; display: block; box-shadow: 0 18px 50px rgba(91,22,117,.16); margin: 18px 0 20px; }

.consent-box { text-align: left; display: grid; gap: 10px; margin: 16px 0; }
.check-row { display: flex; align-items: flex-start; gap: 11px; padding: 13px 14px; border: 1px solid rgba(91,22,117,.12); background: rgba(255,255,255,.64); border-radius: 16px; font-size: .91rem; line-height: 1.38; }
.check-row.compact { padding: 11px 12px; margin-top: 10px; }
.check-row input { width: 20px; height: 20px; flex: 0 0 auto; accent-color: var(--purple); margin-top: 1px; }

.primary-btn, .secondary-btn, .danger-btn {
  appearance: none;
  border: 0;
  border-radius: 17px;
  min-height: 52px;
  padding: 0 19px;
  font-weight: 900;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}
.primary-btn { background: linear-gradient(100deg, var(--purple), #942e93 55%, var(--pink)); color: white; box-shadow: 0 12px 28px rgba(91,22,117,.25); }
.secondary-btn { background: rgba(255,255,255,.8); color: var(--purple); border: 1px solid rgba(91,22,117,.18); }
.danger-btn { background: rgba(168,24,73,.09); color: var(--danger); border: 1px solid rgba(168,24,73,.18); }
.primary-btn:hover, .secondary-btn:hover, .danger-btn:hover { transform: translateY(-1px); }
.primary-btn:active, .secondary-btn:active, .danger-btn:active { transform: translateY(1px) scale(.99); }
.primary-btn:disabled { opacity: .44; cursor: not-allowed; transform: none; }
.primary-btn.wide { width: 100%; }
.small { min-height: 38px; border-radius: 12px; padding: 0 12px; font-size: .82rem; }
.microcopy { margin: 13px 0 0; font-size: .74rem; line-height: 1.45; color: rgba(43,23,51,.58); }

.camera-copy { text-align: center; }
.camera-copy p { color: rgba(43,23,51,.68); line-height: 1.45; }
.camera-stage { position: relative; border-radius: 28px; overflow: hidden; aspect-ratio: 4 / 5; background: #1c1420; box-shadow: inset 0 0 0 1px rgba(255,255,255,.2), 0 18px 45px rgba(31,14,37,.22); }
.camera-stage video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.camera-guide { position: absolute; inset: 18px; pointer-events: none; }
.guide-corner { position: absolute; width: 42px; height: 42px; border-color: rgba(255,255,255,.92); }
.tl { top: 0; left: 0; border-top: 3px solid; border-left: 3px solid; border-radius: 12px 0 0 0; }
.tr { top: 0; right: 0; border-top: 3px solid; border-right: 3px solid; border-radius: 0 12px 0 0; }
.bl { bottom: 0; left: 0; border-bottom: 3px solid; border-left: 3px solid; border-radius: 0 0 0 12px; }
.br { bottom: 0; right: 0; border-bottom: 3px solid; border-right: 3px solid; border-radius: 0 0 12px 0; }
.guide-label { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); color: white; font-size: .67rem; font-weight: 900; letter-spacing: .13em; background: rgba(50,15,63,.55); padding: 7px 10px; border-radius: 999px; white-space: nowrap; }
.countdown { position: absolute; inset: 0; display: grid; place-items: center; color: white; font-size: 7rem; font-weight: 950; text-shadow: 0 12px 50px rgba(0,0,0,.35); background: rgba(44,17,53,.12); pointer-events: none; }
.camera-actions { display: grid; grid-template-columns: .75fr 1.25fr; gap: 10px; margin-top: 14px; }
.error-text { color: #9e204c; font-weight: 750; font-size: .88rem; margin: 10px 0 0; min-height: 1.2em; }

.loading-card { text-align: center; overflow: hidden; }
.spinner-orbit { width: 76px; height: 76px; margin: 0 auto 22px; border-radius: 50%; border: 6px solid rgba(91,22,117,.12); border-top-color: var(--pink); animation: spin .75s linear infinite; position: relative; }
.spinner-orbit span { position: absolute; width: 18px; height: 18px; border-radius: 50%; background: var(--mint); right: -5px; top: 7px; }
@keyframes spin { to { transform: rotate(360deg); } }
.flyer-stack { position: relative; height: 230px; margin-top: 26px; }
.mini-flyer { position: absolute; left: 50%; top: 50%; width: 190px; height: 220px; margin: -110px 0 0 -95px; border-radius: 22px; display: grid; place-items: center; text-align: center; font-weight: 800; letter-spacing: .08em; line-height: 1.8; box-shadow: 0 20px 45px rgba(91,22,117,.18); }
.mini-flyer b { font-size: 1.4rem; }
.f1 { background: var(--mint); transform: rotate(-10deg) translateX(-65px); }
.f2 { background: var(--pink-soft); transform: rotate(8deg) translateX(65px); }
.f3 { color: white; background: var(--purple); transform: rotate(-1deg); animation: flyerPulse .8s ease-in-out infinite alternate; }
@keyframes flyerPulse { to { transform: rotate(1deg) translateY(-5px); } }

.reveal-wrap { width: 100%; text-align: center; }
.reveal-copy { padding: 4px 16px 12px; }
.finalist-card-wrap { position: relative; border-radius: 30px; overflow: hidden; box-shadow: 0 32px 90px rgba(56,16,67,.3); transform: translateZ(0); }
.finalist-preview { width: 100%; display: block; aspect-ratio: 4 / 5; object-fit: cover; background: #2b1733; }
.shine { position: absolute; inset: -120% -40%; transform: rotate(18deg); background: linear-gradient(90deg, transparent 44%, rgba(255,255,255,.42), transparent 57%); animation: shine 2.6s ease-in-out infinite; pointer-events: none; }
@keyframes shine { 0%, 25% { transform: translateX(-45%) rotate(18deg); } 70%, 100% { transform: translateX(55%) rotate(18deg); } }
.reveal-wrap .primary-btn { margin-top: 16px; }

.form-intro { color: rgba(43,23,51,.7); line-height: 1.5; }
#candidateForm { display: grid; gap: 14px; }
label > span, legend { display: block; font-size: .76rem; font-weight: 900; letter-spacing: .04em; color: var(--purple); margin-bottom: 7px; }
input[type="text"], input[type="password"], input[type="tel"], input:not([type]) { width: 100%; }
#candidateForm input[type="text"], #candidateForm input[type="tel"], #candidateForm input[name="instagram"], #candidateForm input[name="name"], .admin-login-card input {
  width: 100%; min-height: 52px; border-radius: 15px; border: 1px solid rgba(91,22,117,.15); background: rgba(255,255,255,.78); padding: 0 14px; outline: none; color: var(--ink); box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}
#candidateForm input:focus, .admin-login-card input:focus { border-color: rgba(91,22,117,.5); box-shadow: 0 0 0 4px rgba(244,87,182,.12); }
.field-grid { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.vibe-fieldset { border: 0; padding: 0; margin: 2px 0 0; }
.vibe-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.vibe-grid label { cursor: pointer; }
.vibe-grid input { position: absolute; opacity: 0; pointer-events: none; }
.vibe-grid span { display: grid; place-items: center; min-height: 48px; border-radius: 14px; margin: 0; background: rgba(255,255,255,.72); border: 1px solid rgba(91,22,117,.13); color: var(--ink); transition: .18s ease; }
.vibe-grid input:checked + span { background: var(--purple); color: white; border-color: var(--purple); transform: translateY(-1px); box-shadow: 0 10px 24px rgba(91,22,117,.2); }

.done-card { text-align: center; }
.crown { width: 88px; height: 88px; border-radius: 50%; margin: 0 auto 18px; display: grid; place-items: center; font-size: 3.4rem; color: white; background: linear-gradient(135deg, var(--orange), var(--pink), var(--purple)); box-shadow: 0 18px 42px rgba(91,22,117,.24); animation: crownPop .6s cubic-bezier(.2,.9,.25,1.3); }
@keyframes crownPop { from { transform: scale(.55) rotate(-12deg); opacity: 0; } }
.message-bubble { margin: 22px 0 18px; padding: 18px; border-radius: 20px; background: linear-gradient(135deg, rgba(112,217,192,.28), rgba(244,87,182,.18)); font-weight: 800; line-height: 1.5; }

.admin-body { padding: 26px 14px; }
.admin-shell { width: min(1160px, 100%); margin: 0 auto; position: relative; z-index: 2; }
.admin-shell.narrow { width: min(520px, 100%); min-height: calc(100vh - 52px); display: grid; place-items: center; }
.admin-login-card { border-radius: 28px; padding: 32px; }
.admin-login-card h1 { font-size: 3rem; }
.admin-login-card form { display: grid; gap: 14px; margin: 22px 0; }
.text-link { color: var(--purple); font-weight: 800; text-decoration: none; }
.admin-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.admin-header h1 { font-size: clamp(2.6rem, 6vw, 4.5rem); margin-bottom: 8px; }
.admin-header p { color: rgba(43,23,51,.62); }
.candidate-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.candidate-card { border-radius: 25px; overflow: hidden; }
.photo-link { display: block; aspect-ratio: 4 / 5; overflow: hidden; background: #231229; }
.photo-link img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .25s ease; }
.photo-link:hover img { transform: scale(1.015); }
.candidate-copy { padding: 18px; }
.candidate-title-row { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.candidate-title-row h2 { font-size: 1.8rem; margin: 0; }
.vibe-pill { background: rgba(112,217,192,.25); color: var(--purple); border-radius: 999px; padding: 7px 10px; font-size: .72rem; font-weight: 900; text-transform: uppercase; }
dl { margin: 15px 0; display: grid; gap: 6px; }
dl div { display: grid; grid-template-columns: 90px 1fr; gap: 8px; font-size: .85rem; }
dt { color: rgba(43,23,51,.55); font-weight: 800; }
dd { margin: 0; overflow-wrap: anywhere; }
.admin-message { padding: 12px; border-radius: 14px; background: rgba(91,22,117,.06); font-size: .86rem; line-height: 1.45; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.admin-actions form { margin: 0; }
.empty-state { padding: 34px; border-radius: 28px; text-align: center; }

@media (max-width: 600px) {
  .app-shell { padding-left: 12px; padding-right: 12px; }
  .hero-card, .camera-card, .form-card, .done-card, .loading-card { border-radius: 27px; padding: 20px; }
  .topbar { padding-top: 6px; }
  .unofficial-pill { font-size: .56rem; }
  .field-grid { grid-template-columns: 1fr; }
  .camera-card { padding: 15px; }
  .camera-copy { padding: 6px 8px; }
  .camera-stage { border-radius: 23px; }
  .candidate-grid { grid-template-columns: 1fr; }
  .admin-header { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}

.channel-fieldset {
  border: 0;
  padding: 0;
  margin: 0;
  transition: opacity .18s ease, filter .18s ease;
}
.channel-fieldset.is-disabled { opacity: .45; filter: grayscale(.25); }
.channel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.channel-grid label { cursor: pointer; }
.channel-grid input { position: absolute; opacity: 0; pointer-events: none; }
.channel-grid span {
  display: flex;
  min-height: 76px;
  padding: 12px 13px;
  border-radius: 14px;
  margin: 0;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(91,22,117,.13);
  color: var(--ink);
  transition: .18s ease;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}
.channel-grid small { font-size: .68rem; line-height: 1.35; color: rgba(43,23,51,.6); font-weight: 650; }
.channel-grid input:checked + span { background: var(--purple); color: white; border-color: var(--purple); box-shadow: 0 10px 24px rgba(91,22,117,.2); }
.channel-grid input:checked + span small { color: rgba(255,255,255,.78); }
.whatsapp-btn {
  min-height: 52px;
  margin: 0 0 12px;
  padding: 0 18px;
  border-radius: 17px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  background: #1f9f5a;
  color: white;
  box-shadow: 0 12px 28px rgba(31,159,90,.22);
}
.whatsapp-btn[hidden] { display: none; }
@media (max-width: 600px) { .channel-grid { grid-template-columns: 1fr; } }


/* One-tap camera source: keep the video alive without showing a camera screen.
   Do not use display:none; some iOS/WebKit versions are more reliable when the
   media element remains renderable. */
.camera-capture-source {
  position: fixed;
  left: -10px;
  top: -10px;
  width: 2px;
  height: 2px;
  opacity: 0.001;
  pointer-events: none;
  object-fit: cover;
  z-index: -1;
}

/* QR entry card and modal */
.qr-top-btn {
  border: 1px solid rgba(91,22,117,.18);
  background: rgba(255,255,255,.72);
  color: var(--purple);
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  font: inherit;
  font-size: .76rem;
  font-weight: 900;
  letter-spacing: .04em;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(91,22,117,.08);
}
.qr-top-btn:hover { transform: translateY(-1px); }

.qr-launch-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  margin: 22px 0 18px;
  padding: 16px 16px 16px 19px;
  border-radius: 23px;
  background: linear-gradient(135deg, rgba(112,217,192,.22), rgba(244,87,182,.13), rgba(255,210,140,.22));
  border: 1px solid rgba(91,22,117,.12);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
}
.qr-copy { min-width: 0; }
.qr-kicker {
  display: block;
  color: var(--purple);
  font-size: .68rem;
  font-weight: 950;
  letter-spacing: .11em;
  margin-bottom: 5px;
}
.qr-copy strong {
  display: block;
  color: var(--ink);
  font-size: 1.35rem;
  line-height: 1.05;
}
.qr-copy small {
  display: block;
  margin-top: 7px;
  color: rgba(43,23,51,.6);
  font-size: .66rem;
  overflow-wrap: anywhere;
}
.qr-image-button {
  width: 112px;
  height: 112px;
  padding: 7px;
  border: 0;
  border-radius: 18px;
  background: white;
  cursor: zoom-in;
  box-shadow: 0 14px 34px rgba(54,18,65,.16);
  transition: transform .18s ease, box-shadow .18s ease;
}
.qr-image-button:hover { transform: scale(1.025) rotate(1deg); box-shadow: 0 18px 42px rgba(54,18,65,.22); }
.qr-image-button img { width: 100%; height: 100%; display: block; border-radius: 10px; }

.qr-modal[hidden] { display: none; }
.qr-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
}
.qr-modal-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: rgba(33,13,40,.68);
  backdrop-filter: blur(8px);
  cursor: pointer;
}
.qr-modal-card {
  position: relative;
  z-index: 1;
  width: min(460px, 100%);
  padding: 30px;
  border-radius: 31px;
  text-align: center;
  animation: qrPop .34s cubic-bezier(.2,.9,.25,1.2);
}
.qr-modal-card h2 { font-size: clamp(1.8rem, 7vw, 3rem); margin: 7px 0 18px; }
.qr-modal-image {
  display: block;
  width: min(300px, 80vw);
  aspect-ratio: 1;
  margin: 0 auto;
  padding: 12px;
  border-radius: 24px;
  background: white;
  box-shadow: 0 18px 50px rgba(55,16,67,.2);
}
.qr-url {
  margin: 15px auto 4px;
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(91,22,117,.07);
  color: var(--purple);
  font-size: .78rem;
  font-weight: 850;
  overflow-wrap: anywhere;
}
.qr-close {
  position: absolute;
  top: 11px;
  right: 13px;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgba(91,22,117,.08);
  color: var(--purple);
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
}
body.modal-open { overflow: hidden; }
@keyframes qrPop { from { transform: translateY(20px) scale(.94); opacity: 0; } }

/* Animated vote prompt under the revealed finalist photo */
.vote-callout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 18px 6px 2px;
  padding: 14px 16px;
  border-radius: 999px;
  color: white;
  background: linear-gradient(100deg, var(--purple), #8e2789, var(--pink), #8e2789, var(--purple));
  background-size: 240% 100%;
  box-shadow: 0 15px 34px rgba(91,22,117,.25);
  animation: voteGlow 2s linear infinite, voteBounce 1.05s ease-in-out infinite alternate;
}
.vote-callout strong {
  font-size: clamp(.84rem, 3.7vw, 1.12rem);
  font-weight: 950;
  letter-spacing: .055em;
  text-shadow: 0 2px 12px rgba(55,16,67,.25);
}
.vote-arrow {
  display: inline-block;
  font-size: 1.25rem;
  font-weight: 950;
  animation: arrowDrop .72s ease-in-out infinite alternate;
}
.vote-arrow:last-child { animation-delay: .2s; }
@keyframes voteGlow { to { background-position: 240% 0; } }
@keyframes voteBounce { to { transform: translateY(4px) scale(1.012); } }
@keyframes arrowDrop { to { transform: translateY(5px); } }

@media (max-width: 600px) {
  .wordmark { font-size: .74rem; letter-spacing: .035em; }
  .qr-top-btn { padding: 0 11px; font-size: .68rem; }
  .qr-launch-card { gap: 12px; padding: 13px; }
  .qr-image-button { width: 94px; height: 94px; border-radius: 15px; }
  .qr-copy strong { font-size: 1.16rem; }
  .qr-modal-card { padding: 26px 19px 22px; }
  .vote-callout { margin-top: 14px; padding: 12px 12px; gap: 7px; }
}

.private-access-footer {
  width: min(100%, 760px);
  margin: 3px auto 0;
  padding: 0 16px calc(12px + env(safe-area-inset-bottom));
  text-align: center;
  position: relative;
  z-index: 2;
}
.private-access-footer a {
  display: inline-block;
  color: rgba(43,23,51,.40);
  font-size: .68rem;
  font-weight: 750;
  letter-spacing: .06em;
  text-decoration: none;
  padding: 6px 9px;
  border-radius: 999px;
}
.private-access-footer a:hover,
.private-access-footer a:focus-visible {
  color: var(--purple);
  background: rgba(255,255,255,.52);
  outline: none;
}
.admin-data-link {
  color: var(--purple);
  font-weight: 800;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
