:root {
  --saffron: #f0803c;
  --saffron-dark: #d4661f;
  --green: #0f8a5f;
  --ink: #241c14;
  --muted: #7a6a5c;
  --card: #fffdf9;
  --line: #efe2d2;
  --shadow: 0 18px 40px -24px rgba(68, 44, 20, 0.45);
}

* { box-sizing: border-box; }

/* several blocks below set display, which would otherwise beat [hidden] */
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans Devanagari", "Baloo 2", system-ui, sans-serif;
  color: var(--ink);
  background: #fdf7ef;
  line-height: 1.6;
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 420px at 12% -8%, #ffe3c7 0%, transparent 70%),
    radial-gradient(760px 380px at 92% 4%, #d8f2e4 0%, transparent 72%),
    #fdf7ef;
}

/* header */
.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 18px clamp(16px, 5vw, 48px);
  background: rgba(255, 253, 249, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 14px; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  font-size: 26px;
  border-radius: 16px;
  background: linear-gradient(145deg, var(--saffron), #f6b26b);
  box-shadow: var(--shadow);
}

.topbar h1 { margin: 0; font-size: clamp(1.1rem, 2.4vw, 1.5rem); letter-spacing: -0.01em; }
.brand-sub { margin: 0; font-size: 0.86rem; color: var(--muted); }

.topbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.lang-btn {
  font: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--saffron-dark);
  background: #fff6ec;
  border: 1px solid #f3d6b7;
}

.lang-btn:hover { background: #ffeeda; }

.account { display: flex; align-items: center; gap: 12px; }
.account-photo { width: 40px; height: 40px; border-radius: 50%; border: 2px solid #fff; box-shadow: var(--shadow); object-fit: cover; }
.account-text { display: flex; flex-direction: column; line-height: 1.3; font-size: 0.85rem; }
.account-text span { color: var(--muted); font-size: 0.78rem; }

main {
  max-width: 880px;
  margin: 0 auto;
  padding: clamp(20px, 4vw, 40px) clamp(16px, 5vw, 32px) 56px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

/* login */
.login-card {
  margin-top: clamp(16px, 6vh, 56px);
  padding: clamp(28px, 5vw, 48px);
  text-align: center;
}

.login-emblem {
  display: inline-grid;
  place-items: center;
  width: 76px;
  height: 76px;
  font-size: 40px;
  border-radius: 26px;
  background: linear-gradient(145deg, #fff0df, #ffe0bd);
  border: 1px solid var(--line);
}

.login-card h2 { margin: 18px 0 8px; font-size: clamp(1.3rem, 3vw, 1.7rem); }
.muted { color: var(--muted); margin: 0 auto; max-width: 42ch; }
.google-button { display: flex; justify-content: center; margin: 26px 0 6px; min-height: 44px; }

.assurance {
  list-style: none;
  padding: 0;
  margin: 24px auto 0;
  display: grid;
  gap: 8px;
  max-width: 34ch;
  text-align: right;
  font-size: 0.86rem;
  color: var(--muted);
}

.assurance li::after { content: " ✓"; color: var(--green); font-weight: 700; }

.hint { font-size: 0.85rem; color: var(--saffron-dark); }

/* vote list */
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-head h2 { margin: 0 0 4px; font-size: clamp(1.2rem, 3vw, 1.6rem); }

.total-chip {
  flex: none;
  text-align: center;
  padding: 10px 18px;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.total-chip span { display: block; font-size: 1.5rem; font-weight: 700; color: var(--green); line-height: 1.1; }
.total-chip small { color: var(--muted); font-size: 0.74rem; }

.banner {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 16px 20px;
  margin-bottom: 20px;
  border-radius: 20px;
  background: #e8f7ee;
  border: 1px solid #bfe6cf;
}

.banner-icon { font-size: 24px; }
.banner p { margin: 2px 0 0; font-size: 0.88rem; color: #3b6a51; }

.candidates { display: grid; gap: 14px; }

.candidate {
  position: relative;
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 18px 20px;
  text-align: right;
  font: inherit;
  color: inherit;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.16s ease, border-color 0.16s ease;
}

.candidate:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--saffron); }
.candidate:disabled { cursor: default; }
.candidate.mine { border-color: var(--green); background: #f4fbf6; }

.avatar {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(145deg, #fff1e0, #ffe2c2);
  border: 1px solid var(--line);
}

.candidate.mine .avatar { background: linear-gradient(145deg, #e3f7ea, #c8eed8); }
.avatar-photo { object-fit: cover; padding: 0; background: #f4ece1; }

.cand-main { text-align: right; min-width: 0; }
.cand-name { margin: 0; font-size: 1.08rem; font-weight: 600; }
.cand-name-en { margin: 0; font-size: 0.84rem; color: var(--muted); font-weight: 500; letter-spacing: 0.01em; }
.cand-meta { margin: 2px 0 0; font-size: 0.84rem; color: var(--muted); }

.cand-count { text-align: center; flex: none; }
.cand-count b { display: block; font-size: 1.35rem; color: var(--green); line-height: 1.1; }
.cand-count small { font-size: 0.72rem; color: var(--muted); }

.bar {
  position: absolute;
  inset: auto 0 0 0;
  height: 4px;
  background: linear-gradient(90deg, var(--saffron), var(--green));
  transition: width 0.4s ease;
}

.tag {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  background: var(--green);
  padding: 3px 10px;
  border-radius: 999px;
}

.empty { padding: 28px; text-align: center; color: var(--muted); }

/* the Hindi layout is right-aligned; English reads better from the left */
html[lang="en"] .candidate,
html[lang="en"] .cand-main,
html[lang="en"] .assurance,
html[lang="en"] .suggest-field,
html[lang="en"] .suggest-field input,
html[lang="en"] .modal-card > p { text-align: left; }

html[lang="en"] .assurance li::after { content: " ✓"; }

/* whatsapp share */
.share-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 22px;
  padding: 20px 22px;
}

.share-box p { margin: 2px 0 0; font-size: 0.88rem; }

.whatsapp-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: #25d366;
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  cursor: pointer;
  box-shadow: 0 10px 24px -14px rgba(37, 211, 102, 0.9);
  transition: filter 0.15s ease, transform 0.15s ease;
}

.whatsapp-btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.whatsapp-btn.compact { padding: 8px 16px; font-size: 0.85rem; box-shadow: none; }

/* buttons */
.primary-btn, .ghost-btn {
  font: inherit;
  font-weight: 600;
  border-radius: 14px;
  padding: 10px 18px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: filter 0.15s ease;
}

.primary-btn { background: var(--saffron); color: #fff; }
.primary-btn:hover { filter: brightness(1.06); }
.ghost-btn { background: transparent; border-color: var(--line); color: var(--muted); }
.ghost-btn:hover { color: var(--ink); border-color: var(--saffron); }

/* modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(36, 28, 20, 0.45);
  backdrop-filter: blur(3px);
}

.modal-card {
  width: min(420px, 100%);
  padding: 26px;
  border-radius: 24px;
  background: var(--card);
  box-shadow: 0 30px 70px -30px rgba(36, 28, 20, 0.6);
}

.suggest-field { display: grid; gap: 5px; margin-bottom: 12px; text-align: right; }
.suggest-field label { font-size: 0.84rem; color: var(--muted); font-weight: 600; }

.suggest-field input {
  font: inherit;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: right;
}

.suggest-field input[type="file"] { text-align: right; font-size: 0.86rem; }
.suggest-field input:focus { outline: 2px solid var(--saffron); outline-offset: 1px; }

.modal-card h3 { margin: 0 0 10px; }
.modal-card p { margin: 0 0 8px; }
.warn { font-size: 0.86rem; color: var(--saffron-dark); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

.notice-bar {
  margin-top: 20px;
  padding: 14px 18px;
  border-radius: 16px;
  background: #e8f7ee;
  border: 1px solid #bfe6cf;
  color: #2f6a4c;
  font-size: 0.9rem;
}

.error-bar {
  margin-top: 20px;
  padding: 14px 18px;
  border-radius: 16px;
  background: #fdeaea;
  border: 1px solid #f3c7c7;
  color: #9a2f2f;
  font-size: 0.9rem;
}

footer {
  padding: 28px 20px 40px;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--line);
}

footer p { margin: 2px 0; }
.tiny { font-size: 0.76rem; opacity: 0.8; }

@media (max-width: 520px) {
  .candidate { grid-template-columns: 48px 1fr; padding: 16px; }
  .avatar { width: 48px; height: 48px; font-size: 20px; }
  .cand-count { grid-column: 2; text-align: right; display: flex; gap: 6px; align-items: baseline; }
  .cand-count b { font-size: 1.1rem; }
  .account-text { display: none; }
}
