/* Sarpanch Vote - Mobile First CSS */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --green: #0B6B3A;
  --green-dark: #08522C;
  --saffron: #F58220;
  --saffron-light: #FFF3E6;
  --bg: #F4F6F5;
  --card: #ffffff;
  --text: #1A1A1A;
  --muted: #666666;
  --border: #E5E7EB;
  --red: #DC2626;
  --star: #FFB800;
}
body {
  font-family: "Noto Sans Devanagari", "Mangal", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
}
.wrap { max-width: 480px; margin: 0 auto; padding: 0 14px 40px; }

/* Header */
.topbar {
  background: linear-gradient(135deg, var(--green-dark), var(--green));
  color: #fff;
  padding: 22px 16px 18px;
  text-align: center;
  border-bottom: 4px solid var(--saffron);
}
.topbar .badge {
  display: inline-block; background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.35);
  font-size: 12px; padding: 4px 10px; border-radius: 20px; margin-bottom: 10px;
}
.topbar h1 { font-size: 24px; line-height: 1.3; }
.topbar p { font-size: 14px; opacity: .92; margin-top: 6px; }
.topbar .village { font-size: 13px; opacity: .85; margin-top: 4px; }

.notice {
  max-width: 480px; margin: 12px auto 0; padding: 0 14px;
}
.notice p {
  background: #FFF8E1; border: 1px solid #FFE082; color: #7A5A00;
  font-size: 12.5px; padding: 10px 12px; border-radius: 10px; text-align: center;
}

/* Cards */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; padding: 18px 16px; margin-top: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.step {
  display: inline-block; background: var(--saffron-light); color: #9A4A00;
  font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 20px; margin-bottom: 8px;
}
.card h2 { font-size: 19px; line-height: 1.35; margin-bottom: 4px; }
.card .sub { font-size: 14px; color: var(--muted); margin-bottom: 14px; }
.card .sub strong { color: var(--text); }

/* Stars */
.stars { display: flex; gap: 6px; justify-content: center; margin: 10px 0 6px; }
.star-btn {
  background: none; border: none; font-size: 42px; line-height: 1;
  color: #D1D5DB; cursor: pointer; padding: 4px 2px; transition: transform .1s;
}
.star-btn:active { transform: scale(1.15); }
.star-btn.on { color: var(--star); }
.star-label { text-align: center; font-size: 15px; font-weight: 700; color: var(--green); min-height: 24px; }

/* Textarea */
textarea, input {
  width: 100%; border: 1.5px solid var(--border); border-radius: 12px;
  padding: 12px 13px; font-size: 16px; font-family: inherit; background: #fff; color: var(--text);
}
textarea { min-height: 96px; resize: vertical; }
textarea:focus, input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(11,107,58,.12); }
.char-count { text-align: right; font-size: 12px; color: var(--muted); margin-top: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip {
  border: 1px solid var(--border); background: #F9FAFB; border-radius: 20px;
  padding: 6px 12px; font-size: 13px; cursor: pointer;
}
.chip.on { background: var(--green); color: #fff; border-color: var(--green); }

/* Candidates */
.cand-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cand {
  border: 2px solid var(--border); border-radius: 16px; padding: 14px 10px 12px;
  text-align: center; cursor: pointer; background: #fff; position: relative;
  transition: border-color .15s, box-shadow .15s;
}
.cand img {
  width: 84px; height: 84px; object-fit: cover; border-radius: 50%;
  border: 3px solid #E8F5EE; display: block; margin: 0 auto 10px;
}
.cand h3 { font-size: 15.5px; line-height: 1.35; }
.cand .info { font-size: 12px; color: var(--muted); margin-top: 2px; }
.cand .pick {
  margin-top: 10px; display: inline-block; font-size: 13px; font-weight: 700;
  background: #F3F4F6; color: #374151; padding: 6px 14px; border-radius: 20px;
}
.cand.selected { border-color: var(--green); box-shadow: 0 0 0 3px rgba(11,107,58,.15); background: #F0FDF4; }
.cand.selected .pick { background: var(--green); color: #fff; }
.cand.selected::after {
  content: "✓"; position: absolute; top: 8px; right: 8px;
  width: 26px; height: 26px; border-radius: 50%; background: var(--green); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700;
}

/* Form fields */
label { display: block; font-size: 14px; font-weight: 700; margin: 12px 0 6px; }
label:first-child { margin-top: 0; }
.hint { font-size: 12.5px; color: var(--muted); font-weight: 400; }
input { font-size: 16px; }
.error { color: var(--red); font-size: 13px; margin-top: 6px; display: none; }
.error.show { display: block; }

.submit-btn {
  width: 100%; background: var(--green); color: #fff; border: none;
  font-size: 18px; font-weight: 700; padding: 15px; border-radius: 14px;
  margin-top: 16px; cursor: pointer; font-family: inherit;
}
.submit-btn:active { background: var(--green-dark); transform: scale(.99); }
.submit-btn:disabled { opacity: .6; cursor: wait; }
.privacy { font-size: 12px; color: var(--muted); text-align: center; margin-top: 10px; }

footer { text-align: center; font-size: 12.5px; color: var(--muted); margin-top: 22px; line-height: 1.7; }

/* Result page */
.total-box {
  background: linear-gradient(135deg, var(--green-dark), var(--green)); color: #fff;
  border-radius: 16px; padding: 18px; text-align: center; margin-top: 14px;
}
.total-box .big { font-size: 34px; font-weight: 800; line-height: 1.1; }
.total-box .lbl { font-size: 13px; opacity: .9; }
.leader {
  background: #FFF7ED; border: 2px solid var(--saffron); border-radius: 16px;
  padding: 16px; margin-top: 14px; text-align: center;
}
.leader img { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; border: 3px solid var(--saffron); }
.leader h2 { font-size: 20px; margin-top: 8px; }
.leader .votes { font-size: 14px; color: #7A3E00; font-weight: 700; }
.result-row { padding: 14px 0; border-bottom: 1px solid var(--border); }
.result-row:last-child { border-bottom: none; }
.result-head { display: flex; align-items: center; gap: 10px; }
.result-head img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.result-head h3 { font-size: 16px; flex: 1; }
.result-head .pct { font-size: 17px; font-weight: 800; color: var(--green); }
.bar { height: 10px; background: #EDEFF1; border-radius: 10px; margin-top: 10px; overflow: hidden; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--green), #22C55E); border-radius: 10px; }
.bar span.first { background: linear-gradient(90deg, var(--saffron), #FFB800); }
.vote-count { font-size: 13px; color: var(--muted); margin-top: 6px; }
.your-vote { background: #F0FDF4; border: 1px solid #BBF7D0; border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-top: 12px; }
.refresh { font-size: 13px; color: var(--muted); text-align: center; margin-top: 12px; }
.btn-secondary {
  display: block; text-align: center; background: #fff; border: 1.5px solid var(--green);
  color: var(--green); font-weight: 700; padding: 12px; border-radius: 12px;
  text-decoration: none; margin-top: 14px; font-size: 15px;
}
.demo-tag {
  display: inline-block; background: #FEF3C7; color: #92400E; font-size: 12px;
  font-weight: 700; padding: 4px 10px; border-radius: 20px; margin-top: 8px;
}
@media (max-width: 360px) { .star-btn { font-size: 36px; } .topbar h1 { font-size: 21px; } }
