/* =========================================================
   bhsf投票 · BHSF VOTE
   A warm editorial voting site
   ========================================================= */

:root {
  --paper: #f3ede1;
  --paper-deep: #e9e0cf;
  --card: #fbf7ed;
  --card-bright: #fffdf7;
  --ink: #191b16;
  --ink-soft: #34372e;
  --muted: #6e7063;
  --muted-strong: #55584d;
  --line: rgba(25, 27, 22, 0.14);
  --line-strong: rgba(25, 27, 22, 0.26);
  --accent: #d94b2b;
  --accent-deep: #b6371b;
  --accent-soft: #f2d7cb;
  --green: #1c3d32;
  --green-light: #2a5648;
  --cream: #f8f2e4;
  --yellow: #e3b24a;
  --danger: #b3352b;
  --font: "Microsoft YaHei", "微软雅黑", "PingFang SC", "Segoe UI", sans-serif;
  --shadow-soft: 0 24px 70px -40px rgba(28, 33, 24, 0.36);
  --shadow-card: 0 18px 40px -26px rgba(28, 33, 24, 0.44);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --max-width: 1240px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 110px;
}

body {
  margin: 0;
  min-width: 300px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(1100px 750px at 94% -10%, rgba(217, 75, 43, 0.1), transparent 60%),
    radial-gradient(900px 800px at -8% 34%, rgba(28, 61, 50, 0.08), transparent 62%),
    var(--paper);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.modal-open {
  overflow: hidden;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1500;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

::selection {
  color: var(--cream);
  background: var(--accent);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  display: inline-block;
  vertical-align: -0.18em;
}

.icon-sm {
  width: 16px;
  height: 16px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* =========================================================
   Header
   ========================================================= */

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid var(--line);
  background: rgba(243, 237, 225, 0.84);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
}

.header-inner {
  max-width: var(--max-width);
  min-height: 82px;
  margin: 0 auto;
  padding: 14px 32px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  width: max-content;
  border-radius: 12px;
}

.brand-mark {
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  color: var(--cream);
  background: var(--accent);
  border-radius: 50%;
  transform: rotate(-7deg);
  box-shadow: 0 4px 0 rgba(182, 55, 27, 0.24);
  transition: transform 220ms ease;
}

.brand:hover .brand-mark {
  transform: rotate(5deg) scale(1.04);
}

.brand-mark svg {
  width: 27px;
  height: 27px;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand-copy strong {
  font-family: var(--font);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.brand-latin {
  margin-right: 2px;
  font-family: var(--font);
  font-size: 0.78em;
  font-weight: 800;
  letter-spacing: -0.045em;
}

.brand-copy small {
  margin-top: 6px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.46);
}

.nav-tab {
  min-height: 38px;
  padding: 7px 19px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted-strong);
  background: transparent;
  border: 0;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.nav-tab:hover {
  color: var(--ink);
  background: rgba(25, 27, 22, 0.05);
}

.nav-tab.is-active {
  color: var(--cream);
  background: var(--ink);
  box-shadow: 0 3px 9px rgba(25, 27, 22, 0.18);
}

.nav-tab.is-active .icon {
  color: var(--cream);
}

.header-right {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 37px;
  padding: 0 14px;
  border: 1px solid rgba(28, 61, 50, 0.18);
  border-radius: 999px;
  color: var(--green);
  background: rgba(28, 61, 50, 0.06);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill.is-closed {
  color: var(--muted-strong);
  border-color: var(--line);
  background: rgba(25, 27, 22, 0.04);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3c8a62;
  box-shadow: 0 0 0 0 rgba(60, 138, 98, 0.5);
  animation: pulse 2.4s infinite;
}

.status-pill.is-closed .status-dot {
  background: #8c8d82;
  animation: none;
}

.icon-button {
  width: 37px;
  height: 37px;
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 50%;
  transition: background 180ms ease, transform 260ms ease;
}

.icon-button:hover {
  background: rgba(25, 27, 22, 0.05);
  transform: rotate(24deg);
}

.icon-button.is-loading .icon {
  animation: spin 700ms linear infinite;
}

/* =========================================================
   Shared button, field, kicker
   ========================================================= */

.btn {
  min-height: 47px;
  padding: 11px 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
  transition: transform 180ms ease, background 180ms ease, color 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}

.btn.is-busy {
  pointer-events: none;
}

.btn-primary {
  color: var(--cream);
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 8px 20px -12px rgba(217, 75, 43, 0.8);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  box-shadow: 0 14px 28px -14px rgba(182, 55, 27, 0.7);
}

.btn-dark {
  color: var(--cream);
  background: var(--green);
  border-color: var(--green);
}

.btn-dark:hover:not(:disabled) {
  background: var(--green-light);
  border-color: var(--green-light);
}

.btn-ghost {
  color: var(--ink);
  background: transparent;
  border-color: var(--line-strong);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(25, 27, 22, 0.055);
}

.btn-danger {
  color: #fff9f5;
  background: var(--danger);
  border-color: var(--danger);
}

.btn-danger:hover:not(:disabled) {
  background: #8f2921;
}

.btn-danger-ghost {
  color: var(--danger);
  background: rgba(179, 53, 43, 0.04);
  border-color: rgba(179, 53, 43, 0.28);
}

.btn-danger-ghost:hover:not(:disabled) {
  background: rgba(179, 53, 43, 0.09);
}

.btn-sm {
  min-height: 38px;
  padding: 8px 14px;
  font-size: 13px;
  border-radius: 8px;
}

.btn-block {
  width: 100%;
}

.text-link {
  padding: 0;
  color: var(--muted-strong);
  background: none;
  border: 0;
  font-size: 13px;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 4px;
}

.text-link:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.section-kicker {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.22em;
  line-height: 1.4;
}

.section-kicker.light {
  color: rgba(248, 242, 228, 0.5);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field-label {
  display: block;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.required {
  color: var(--accent);
}

.field input,
.field textarea,
.field select,
.login-form input {
  width: 100%;
  min-height: 45px;
  padding: 10px 13px;
  color: var(--ink);
  background: rgba(255, 253, 247, 0.7);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  outline: none;
  transition: border-color 170ms ease, box-shadow 170ms ease, background 170ms ease;
}

.field textarea {
  resize: vertical;
  min-height: 108px;
  line-height: 1.65;
}

.field input::placeholder,
.field textarea::placeholder,
.login-form input::placeholder {
  color: #9a9a8d;
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.login-form input:focus {
  background: var(--card-bright);
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(28, 61, 50, 0.1);
}

.field-hint {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.form-error {
  margin: 0;
  padding: 9px 11px;
  color: #9e2c23;
  background: rgba(179, 53, 43, 0.075);
  border-left: 3px solid var(--danger);
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.5;
}

.password-wrap {
  position: relative;
  display: block;
}

.password-wrap input {
  padding-right: 46px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 7px;
  transform: translateY(-50%);
}

.password-toggle:hover {
  color: var(--ink);
  background: rgba(25, 27, 22, 0.05);
}

/* =========================================================
   Voting view: hero
   ========================================================= */

.site-main {
  min-height: 60vh;
}

.view {
  animation: viewIn 380ms ease both;
}

.hero {
  position: relative;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 86px 32px 58px;
  display: grid;
  grid-template-columns: minmax(0, 1.22fr) minmax(360px, 0.78fr);
  align-items: stretch;
  gap: 64px;
}

.hero::before {
  content: "";
  position: absolute;
  top: 42px;
  left: 16px;
  width: 18px;
  height: 18px;
  border-top: 1px solid var(--line-strong);
  border-left: 1px solid var(--line-strong);
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  animation: fadeUp 620ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.eyebrow {
  margin: 0 0 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.19em;
}

.eyebrow-rule {
  width: 40px;
  height: 1px;
  background: var(--accent);
}

.hero h1 {
  margin: 0;
  font-family: var(--font);
  font-size: clamp(3.8rem, 7.1vw, 6.85rem);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.hero h1 em {
  position: relative;
  color: var(--accent);
  font-style: normal;
  white-space: nowrap;
}

.hero h1 em::after {
  content: "";
  position: absolute;
  left: 0.04em;
  right: -0.02em;
  bottom: 0.02em;
  height: 0.075em;
  background: var(--accent);
  opacity: 0.28;
  transform: rotate(-1deg);
  border-radius: 999px;
}

.hero-lede {
  max-width: 440px;
  margin: 28px 0 0;
  color: var(--muted-strong);
  font-size: 15px;
  line-height: 1.9;
  white-space: pre-line;
}

.hero-actions {
  margin-top: 34px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.hero-note {
  margin: 30px 0 0;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.hero-note strong {
  color: var(--ink);
  font-weight: 800;
}

.mini-avatars {
  display: flex;
  padding-left: 6px;
}

.mini-avatar {
  width: 28px;
  height: 28px;
  margin-left: -6px;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--cream);
  background: linear-gradient(140deg, var(--avatar-a, #3b6b58), var(--avatar-b, #1c3d32));
  border: 2px solid var(--paper);
  border-radius: 50%;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
}

.mini-avatar:nth-child(2) {
  background: linear-gradient(140deg, var(--avatar-a, #d86a48), var(--avatar-b, #a83a22));
}

.mini-avatar:nth-child(3) {
  background: linear-gradient(140deg, var(--avatar-a, #b39145), var(--avatar-b, #6e5321));
}

.mini-avatar:nth-child(4) {
  background: linear-gradient(140deg, var(--avatar-a, #6d7f91), var(--avatar-b, #354657));
}

/* Tally card */

.tally-card {
  position: relative;
  min-height: 430px;
  padding: 28px 30px 26px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--cream);
  background:
    radial-gradient(400px 260px at 100% 0%, rgba(227, 178, 74, 0.16), transparent 65%),
    linear-gradient(145deg, #23483b, #173127 70%);
  border-radius: 22px;
  box-shadow: 0 30px 60px -32px rgba(23, 49, 39, 0.55);
  animation: fadeUp 620ms 100ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.tally-card::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(248, 242, 228, 0.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(248, 242, 228, 0.14) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(to bottom, black, transparent 75%);
  -webkit-mask-image: linear-gradient(to bottom, black, transparent 75%);
  pointer-events: none;
}

.tally-card > * {
  position: relative;
  z-index: 1;
}

.tally-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: rgba(248, 242, 228, 0.52);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.25em;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  color: var(--cream);
  background: rgba(248, 242, 228, 0.1);
  border: 1px solid rgba(248, 242, 228, 0.14);
  border-radius: 999px;
  font-size: 9px;
  letter-spacing: 0.1em;
}

.live-badge i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--yellow);
  animation: pulse 2s infinite;
}

.tally-main {
  margin-top: auto;
  padding-top: 34px;
}

.tally-number {
  font-family: var(--font);
  font-size: clamp(4.6rem, 7.4vw, 6.7rem);
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: -0.06em;
  font-variant-numeric: tabular-nums;
  transition: transform 220ms ease;
}

.tally-number.bump {
  animation: numberBump 460ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.tally-caption {
  margin-top: 11px;
  color: rgba(248, 242, 228, 0.58);
  font-size: 12px;
  letter-spacing: 0.1em;
}

.tally-rule {
  height: 1px;
  margin: 28px 0 24px;
  background: rgba(248, 242, 228, 0.16);
}

.tally-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.tally-meta div {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.tally-meta span {
  color: rgba(248, 242, 228, 0.48);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.tally-meta strong {
  font-family: var(--font);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.tally-meta small {
  margin-left: 3px;
  color: rgba(248, 242, 228, 0.55);
  font-family: var(--font);
  font-size: 10px;
  font-weight: 500;
}

.tally-stamp {
  position: absolute;
  right: -7px;
  bottom: -11px;
  width: 118px;
  height: 118px;
  color: rgba(248, 242, 228, 0.3);
  transform: rotate(-12deg);
  pointer-events: none;
}

.tally-stamp svg {
  width: 100%;
  height: 100%;
}

.tally-stamp text {
  fill: currentColor;
  font-family: var(--font);
  font-size: 5.2px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

/* Ticker */

.ticker {
  overflow: hidden;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.ticker-track {
  width: max-content;
  min-width: 100%;
  padding: 12px 0;
  display: flex;
  align-items: center;
  gap: 30px;
  animation: tickerMove 32s linear infinite;
}

.ticker-track span {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.25em;
  white-space: nowrap;
}

.ticker-track i {
  width: 5px;
  height: 5px;
  background: var(--accent);
  transform: rotate(45deg);
  flex: 0 0 auto;
}

/* =========================================================
   Voting view: candidate section
   ========================================================= */

.candidates-section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 76px 32px 94px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.section-title-wrap h2 {
  margin: 0;
  font-family: var(--font);
  font-size: clamp(2.2rem, 4vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.1;
}

.count-badge {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  margin-left: 6px;
  padding: 0 8px;
  color: var(--cream);
  background: var(--accent);
  border-radius: 999px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 800;
  vertical-align: 0.34em;
  letter-spacing: 0;
}

.candidate-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-field {
  width: 230px;
  min-height: 42px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  background: rgba(255, 253, 247, 0.52);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
}

.search-field:focus-within {
  background: var(--card-bright);
  border-color: var(--green);
}

.search-field .icon {
  width: 17px;
  height: 17px;
}

.search-field input {
  width: 100%;
  min-width: 0;
  padding: 0;
  background: transparent;
  border: 0;
  outline: none;
  font-size: 13px;
}

.search-field input::placeholder {
  color: #929286;
}

.select-field {
  position: relative;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  background: rgba(255, 253, 247, 0.52);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
}

.select-field select {
  appearance: none;
  min-height: 40px;
  padding: 0 38px 0 13px;
  background: transparent;
  border: 0;
  outline: none;
  font-size: 13px;
  cursor: pointer;
}

.select-field > .icon {
  position: absolute;
  right: 11px;
  color: var(--muted);
  pointer-events: none;
}

.candidate-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  padding-top: 30px;
}

.candidate-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset;
  transition: transform 260ms cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 260ms ease, border-color 260ms ease;
  animation: cardIn 480ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.candidate-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 30px 50px -32px rgba(28, 33, 24, 0.48);
  border-color: rgba(25, 27, 22, 0.36);
}

.candidate-card.is-voted {
  border-color: rgba(28, 61, 50, 0.55);
}

.candidate-media {
  position: relative;
  aspect-ratio: 4 / 3.15;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(28, 61, 50, 0.18), rgba(217, 75, 43, 0.14)),
    var(--paper-deep);
}

.candidate-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 600ms cubic-bezier(0.2, 0.7, 0.2, 1), filter 300ms ease;
}

.candidate-card:hover .candidate-media img {
  transform: scale(1.035);
}

.candidate-avatar {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--cream);
  background:
    radial-gradient(120% 120% at 15% 15%, var(--avatar-a, #3b6b58), transparent 60%),
    linear-gradient(140deg, var(--avatar-a, #3b6b58), var(--avatar-b, #1c3d32));
  font-family: var(--font);
  font-size: clamp(3rem, 6vw, 5rem);
  font-weight: 700;
  letter-spacing: -0.08em;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.12);
}

.candidate-avatar::after {
  content: "";
  width: 44%;
  height: 44%;
  position: absolute;
  border: 1px solid rgba(248, 242, 228, 0.32);
  border-radius: 50%;
}

.candidate-index {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1;
  min-width: 35px;
  height: 27px;
  padding: 0 8px;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: rgba(251, 247, 237, 0.9);
  border: 1px solid rgba(25, 27, 22, 0.15);
  border-radius: 999px;
  backdrop-filter: blur(5px);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.candidate-status-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  padding: 5px 9px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--cream);
  background: rgba(28, 61, 50, 0.9);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  backdrop-filter: blur(5px);
}

.candidate-status-badge .icon {
  width: 12px;
  height: 12px;
}

.candidate-body {
  flex: 1;
  padding: 20px 20px 19px;
  display: flex;
  flex-direction: column;
}

.candidate-name-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.candidate-name {
  margin: 0;
  font-family: var(--font);
  font-size: 25px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

.vote-pill {
  flex: 0 0 auto;
  margin-top: 3px;
  padding: 3px 7px;
  color: var(--muted-strong);
  background: rgba(25, 27, 22, 0.045);
  border-radius: 5px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.vote-pill strong {
  color: var(--ink);
  font-size: 12px;
}

.candidate-tagline {
  margin: 8px 0 0;
  color: var(--accent-deep);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.candidate-bio {
  margin: 10px 0 0;
  color: var(--muted-strong);
  font-size: 12.5px;
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.candidate-bio.is-empty {
  color: var(--muted);
  font-style: italic;
}

.candidate-footer {
  margin-top: 18px;
  padding-top: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--line);
}

.vote-meter {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.vote-meter-label {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.06em;
}

.vote-meter-track {
  height: 3px;
  overflow: hidden;
  background: rgba(25, 27, 22, 0.09);
  border-radius: 999px;
}

.vote-meter-fill {
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  transition: width 500ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.vote-button {
  min-width: 100px;
  min-height: 40px;
  padding: 8px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  transition: color 180ms ease, background 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.vote-button:hover:not(:disabled) {
  color: var(--cream);
  background: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.vote-button:disabled {
  cursor: default;
}

.vote-button.is-voted {
  color: var(--green);
  background: rgba(28, 61, 50, 0.075);
  border-color: rgba(28, 61, 50, 0.28);
}

.vote-button.is-used {
  color: var(--muted);
  background: rgba(25, 27, 22, 0.035);
  border-color: var(--line);
}

.vote-button.is-closed {
  color: var(--muted);
  background: transparent;
  border-color: var(--line);
}

.vote-button.is-busy .icon {
  animation: spin 700ms linear infinite;
}

.candidate-card .candidate-count-enter {
  animation: numberBump 460ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Empty state */

.empty-state {
  margin-top: 30px;
  padding: 76px 24px 70px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: rgba(255, 253, 247, 0.28);
}

.empty-illustration {
  position: relative;
  width: 150px;
  height: 120px;
  margin-bottom: 24px;
}

.empty-ballot {
  position: absolute;
  left: 30px;
  bottom: 0;
  width: 85px;
  height: 92px;
  padding: 19px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--card-bright);
  border: 1.5px solid var(--ink);
  border-radius: 5px;
  transform: rotate(-5deg);
  box-shadow: 7px 7px 0 rgba(25, 27, 22, 0.08);
}

.empty-ballot span {
  height: 3px;
  background: var(--line-strong);
  border-radius: 999px;
}

.empty-ballot span:nth-child(1) {
  width: 100%;
}

.empty-ballot span:nth-child(2) {
  width: 72%;
}

.empty-ballot span:nth-child(3) {
  width: 46%;
}

.empty-ballot svg {
  width: 23px;
  height: 23px;
  margin-top: 4px;
  color: var(--accent);
}

.empty-spark {
  position: absolute;
  color: var(--accent);
}

.empty-spark.s1 {
  top: 10px;
  left: 14px;
  width: 21px;
  height: 21px;
  transform: rotate(12deg);
}

.empty-spark.s2 {
  top: 28px;
  right: 10px;
  width: 12px;
  height: 12px;
  color: var(--yellow);
  transform: rotate(20deg);
}

.empty-state h3 {
  margin: 0;
  font-family: var(--font);
  font-size: 25px;
  letter-spacing: -0.02em;
}

.empty-state p {
  max-width: 330px;
  margin: 8px 0 22px;
  color: var(--muted);
  font-size: 13px;
}

.vote-footnote {
  margin-top: 34px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
}

.no-results {
  grid-column: 1 / -1;
  padding: 70px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  background: rgba(255, 253, 247, 0.3);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  text-align: center;
}

.no-results p {
  margin: 0;
  font-size: 13px;
}

.candidate-grid.no-entrance .candidate-card {
  animation: none;
}

.vote-footnote p {
  margin: 0;
  max-width: 760px;
  font-size: 11px;
  line-height: 1.7;
  text-align: center;
}

.footnote-mark {
  color: var(--accent);
  font-size: 12px;
}

/* =========================================================
   Admin lock screen
   ========================================================= */

.admin-view {
  padding: 52px 32px 90px;
}

.admin-lock {
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.04fr 0.96fr;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 26px;
  box-shadow: var(--shadow-soft);
}

.lock-aside {
  position: relative;
  min-height: 600px;
  padding: 62px 54px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--cream);
  background:
    radial-gradient(500px 340px at 100% 10%, rgba(227, 178, 74, 0.14), transparent 60%),
    linear-gradient(150deg, #284f42, #173127 74%);
}

.lock-aside::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.17;
  background-image:
    linear-gradient(rgba(248, 242, 228, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(248, 242, 228, 0.18) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(circle at 78% 20%, black, transparent 70%);
  -webkit-mask-image: radial-gradient(circle at 78% 20%, black, transparent 70%);
}

.lock-aside > * {
  position: relative;
  z-index: 1;
}

.lock-aside h1 {
  margin: 62px 0 0;
  font-family: var(--font);
  font-size: clamp(2.8rem, 4vw, 3.9rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.05em;
}

.lock-aside-lede {
  max-width: 350px;
  margin: 23px 0 0;
  color: rgba(248, 242, 228, 0.62);
  font-size: 13px;
  line-height: 1.85;
}

.lock-points {
  margin: 48px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  list-style: none;
  border-top: 1px solid rgba(248, 242, 228, 0.14);
}

.lock-points li {
  padding: 14px 0;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid rgba(248, 242, 228, 0.14);
  color: rgba(248, 242, 228, 0.7);
  font-size: 12px;
}

.lock-points span {
  color: var(--yellow);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.lock-aside-mark {
  position: absolute;
  right: 34px;
  bottom: 27px;
  z-index: 1;
  width: 96px;
  height: 96px;
  color: rgba(248, 242, 228, 0.15);
  transform: rotate(14deg);
}

.lock-aside-mark svg {
  width: 100%;
  height: 100%;
}

.lock-panel {
  padding: 72px 62px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.lock-icon {
  width: 54px;
  height: 54px;
  margin-bottom: 30px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 50%;
  transform: rotate(-4deg);
}

.lock-icon .icon {
  width: 24px;
  height: 24px;
}

.lock-panel h2 {
  margin: 0;
  font-family: var(--font);
  font-size: 37px;
  line-height: 1.2;
  letter-spacing: -0.035em;
}

.lock-help {
  margin: 11px 0 28px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-form .btn {
  margin-top: 4px;
}

.first-run-tip {
  margin: 18px 0 0;
  padding: 10px 12px;
  color: var(--muted-strong);
  background: rgba(227, 178, 74, 0.12);
  border: 1px solid rgba(227, 178, 74, 0.24);
  border-radius: 7px;
  font-size: 11px;
  line-height: 1.6;
}

.first-run-tip code {
  padding: 1px 4px;
  color: var(--ink);
  background: rgba(255, 253, 247, 0.75);
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
}

.lock-panel .text-link {
  align-self: flex-start;
  margin-top: 28px;
}

/* =========================================================
   Admin dashboard
   ========================================================= */

.admin-dashboard {
  max-width: 1320px;
  margin: 0 auto;
  animation: fadeUp 420ms ease both;
}

.admin-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  padding: 10px 0 30px;
}

.admin-toolbar h1 {
  margin: 0;
  font-family: var(--font);
  font-size: clamp(2.5rem, 4vw, 3.45rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.admin-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.admin-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.unlocked-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 13px;
  color: var(--green);
  background: rgba(28, 61, 50, 0.07);
  border: 1px solid rgba(28, 61, 50, 0.18);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.unlocked-badge i {
  width: 6px;
  height: 6px;
  background: #3c8a62;
  border-radius: 50%;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  min-height: 128px;
  padding: 20px 21px;
  display: flex;
  flex-direction: column;
  background: rgba(251, 247, 237, 0.68);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.stat-card.accent {
  color: var(--cream);
  background: var(--accent);
  border-color: var(--accent);
}

.stat-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.stat-card.accent .stat-label {
  color: rgba(248, 242, 228, 0.7);
}

.stat-value {
  margin-top: auto;
  font-family: var(--font);
  font-size: 38px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.stat-value.stat-text {
  font-family: var(--font);
  font-size: 24px;
  letter-spacing: -0.02em;
}

.stat-note {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
}

.stat-card.accent .stat-note {
  color: rgba(248, 242, 228, 0.68);
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: start;
  gap: 20px;
}

.panel {
  background: rgba(251, 247, 237, 0.82);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.55) inset;
}

.admin-candidates-panel {
  min-width: 0;
  padding: 25px 25px 12px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.panel-head h2 {
  margin: 0;
  font-family: var(--font);
  font-size: 23px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.panel-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.6;
}

.compact-head {
  margin-bottom: 17px;
}

.compact-head h2 {
  font-size: 18px;
}

.admin-list-tools {
  margin: 20px 0 5px;
  display: flex;
  gap: 8px;
}

.search-field.compact {
  flex: 1;
  width: auto;
  min-height: 38px;
}

.select-field.compact {
  min-height: 38px;
}

.select-field.compact select {
  min-height: 36px;
  font-size: 12px;
}

.admin-candidate-list {
  margin-top: 5px;
}

.admin-candidate-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 15px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.admin-candidate-row:last-child {
  border-bottom: 0;
}

.admin-cand-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-avatar {
  position: relative;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--cream);
  border-radius: 10px;
  background:
    radial-gradient(120% 120% at 15% 15%, var(--avatar-a, #3b6b58), transparent 60%),
    linear-gradient(140deg, var(--avatar-a, #3b6b58), var(--avatar-b, #1c3d32));
  font-family: var(--font);
  font-size: 20px;
  font-weight: 700;
}

.admin-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-cand-copy {
  min-width: 0;
}

.admin-cand-name {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.4;
}

.admin-cand-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hidden-badge {
  flex: 0 0 auto;
  padding: 2px 5px;
  color: var(--muted);
  background: rgba(25, 27, 22, 0.055);
  border-radius: 3px;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.admin-cand-meta {
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vote-control {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: rgba(255, 253, 247, 0.72);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.vote-control button {
  width: 24px;
  height: 27px;
  display: grid;
  place-items: center;
  color: var(--muted-strong);
  background: transparent;
  border: 0;
  border-radius: 4px;
  font-size: 17px;
  line-height: 1;
}

.vote-control button:hover:not(:disabled) {
  color: var(--ink);
  background: rgba(25, 27, 22, 0.055);
}

.vote-control button:disabled {
  opacity: 0.35;
  cursor: wait;
}

.vote-control input {
  width: 48px;
  min-height: 27px;
  padding: 2px 3px;
  text-align: center;
  background: transparent;
  border: 0;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  border-radius: 0;
  outline: none;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.vote-control input:focus {
  background: var(--card-bright);
  box-shadow: 0 0 0 2px rgba(28, 61, 50, 0.12);
}

/* Switch */

.switch {
  position: relative;
  width: 39px;
  height: 23px;
  flex: 0 0 auto;
  display: inline-block;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch-track {
  position: absolute;
  inset: 0;
  background: rgba(25, 27, 22, 0.16);
  border-radius: 999px;
  transition: background 180ms ease;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 17px;
  height: 17px;
  background: var(--card-bright);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(25, 27, 22, 0.25);
  transition: transform 180ms ease;
}

.switch input:checked + .switch-track {
  background: var(--green);
}

.switch input:checked + .switch-track::after {
  transform: translateX(16px);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.row-icon-btn {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
}

.row-icon-btn:hover {
  color: var(--ink);
  background: rgba(25, 27, 22, 0.05);
  border-color: var(--line);
}

.row-icon-btn.danger:hover {
  color: var(--danger);
  background: rgba(179, 53, 43, 0.06);
  border-color: rgba(179, 53, 43, 0.2);
}

.row-icon-btn .icon {
  width: 15px;
  height: 15px;
}

.admin-list-empty {
  padding: 46px 16px 50px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

.admin-list-empty p {
  margin: 0;
}

.admin-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.admin-side .panel {
  padding: 21px;
}

.switch-row {
  min-height: 57px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}

.switch-row > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.switch-row strong {
  font-size: 12.5px;
  font-weight: 700;
}

.switch-row > div span {
  color: var(--muted);
  font-size: 10.5px;
}

.settings-panel .switch-row:nth-of-type(2) {
  border-bottom: 0;
}

.field-inline {
  margin: 16px 0 17px;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.field-inline .field-label {
  white-space: nowrap;
}

.select-field.small {
  min-height: 34px;
}

.select-field.small select {
  min-height: 32px;
  padding-right: 32px;
  font-size: 12px;
}

.select-field.small > .icon {
  right: 9px;
}

.password-panel form,
.hero-copy-panel form {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.hero-copy-panel .field {
  gap: 5px;
}

.hero-copy-panel .field input,
.hero-copy-panel .field textarea {
  min-height: 38px;
  font-size: 12px;
}

.hero-copy-panel .field textarea {
  min-height: 76px;
}

.password-panel .field {
  gap: 5px;
}

.password-panel .field input {
  min-height: 38px;
  font-size: 12px;
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.activity-item {
  padding: 9px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}

.activity-item:last-child {
  border-bottom: 0;
}

.activity-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted-strong);
  font-size: 11px;
}

.activity-dot {
  width: 5px;
  height: 5px;
  flex: 0 0 auto;
  background: var(--accent);
  border-radius: 50%;
}

.activity-main strong {
  overflow: hidden;
  color: var(--ink);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 9px;
}

.activity-empty {
  padding: 15px 0 4px;
  color: var(--muted);
  font-size: 11px;
}

.danger-panel {
  border-color: rgba(179, 53, 43, 0.18);
}

.danger-panel .panel-head p {
  color: #9a6b64;
}

/* =========================================================
   Footer
   ========================================================= */

.site-footer {
  color: var(--cream);
  background: var(--ink);
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 42px 32px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

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

.footer-mark {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  color: var(--ink);
  background: var(--yellow);
  border-radius: 50%;
  font-family: var(--font);
  font-size: 18px;
  font-weight: 700;
  transform: rotate(-5deg);
}

.footer-brand p {
  margin: 0;
  color: rgba(248, 242, 228, 0.62);
  font-family: var(--font);
  font-size: 19px;
  letter-spacing: 0.02em;
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 20px;
  color: rgba(248, 242, 228, 0.38);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.footer-admin-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  color: rgba(248, 242, 228, 0.56);
  background: transparent;
  border: 1px solid rgba(248, 242, 228, 0.18);
  border-radius: 6px;
  font-size: 10px;
  letter-spacing: 0.08em;
}

.footer-admin-link:hover {
  color: var(--cream);
  border-color: rgba(248, 242, 228, 0.4);
}

/* =========================================================
   Modals
   ========================================================= */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  padding: 24px;
  display: grid;
  place-items: center;
  background: rgba(18, 24, 18, 0.58);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  animation: overlayIn 180ms ease both;
}

.modal {
  position: relative;
  width: min(840px, 100%);
  max-height: calc(100vh - 48px);
  padding: 38px 40px 34px;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid rgba(25, 27, 22, 0.18);
  border-radius: 22px;
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.5);
  animation: modalIn 260ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.modal-close {
  position: absolute;
  top: 17px;
  right: 17px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 50%;
}

.modal-close:hover {
  color: var(--ink);
  background: rgba(25, 27, 22, 0.05);
}

.modal-close .icon {
  width: 16px;
  height: 16px;
}

.modal-head {
  padding-right: 40px;
}

.modal-head h2 {
  margin: 0;
  font-family: var(--font);
  font-size: 34px;
  line-height: 1.2;
  letter-spacing: -0.035em;
}

.modal-head > p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.candidate-form-grid {
  margin-top: 26px;
  display: grid;
  grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.22fr);
  gap: 28px;
}

.image-column {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.image-drop {
  position: relative;
  aspect-ratio: 4 / 4.4;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background:
    radial-gradient(80% 80% at 30% 20%, rgba(28, 61, 50, 0.08), transparent 60%),
    rgba(255, 253, 247, 0.5);
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease;
}

.image-drop:hover,
.image-drop.is-dragging {
  background: rgba(217, 75, 43, 0.045);
  border-color: var(--accent);
}

.image-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.image-drop-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  text-align: center;
}

.image-drop-empty .icon {
  width: 27px;
  height: 27px;
  margin-bottom: 4px;
  color: var(--accent);
}

.image-drop-empty strong {
  color: var(--ink-soft);
  font-size: 12px;
}

.image-drop-empty span {
  font-size: 10px;
}

.image-preview-wrap {
  position: absolute;
  inset: 0;
}

.image-preview-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-change-hint {
  position: absolute;
  left: 50%;
  bottom: 10px;
  padding: 5px 10px;
  color: var(--cream);
  background: rgba(25, 27, 22, 0.64);
  border-radius: 999px;
  font-size: 9px;
  white-space: nowrap;
  transform: translateX(-50%);
  backdrop-filter: blur(5px);
}

.image-remove {
  align-self: flex-start;
}

.fields-column {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.fields-column .field textarea {
  min-height: 92px;
}

.modal-actions {
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
}

.confirm-modal {
  width: min(420px, 100%);
  padding: 34px 32px 30px;
  text-align: center;
}

.confirm-icon {
  width: 50px;
  height: 50px;
  margin: 0 auto 17px;
  display: grid;
  place-items: center;
  color: var(--danger);
  background: rgba(179, 53, 43, 0.09);
  border-radius: 50%;
}

.confirm-icon.is-warn {
  color: #966713;
  background: rgba(227, 178, 74, 0.16);
}

.confirm-icon .icon {
  width: 22px;
  height: 22px;
}

.confirm-modal h2 {
  margin: 0;
  font-family: var(--font);
  font-size: 25px;
  letter-spacing: -0.025em;
}

.confirm-modal > p {
  margin: 9px 0 22px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}

.confirm-modal .modal-actions {
  justify-content: center;
}

/* Toasts */

.toast-stack {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

.toast {
  max-width: 340px;
  padding: 12px 15px 12px 13px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--cream);
  background: var(--ink);
  border: 1px solid rgba(248, 242, 228, 0.14);
  border-radius: 9px;
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.55);
  font-size: 12px;
  line-height: 1.55;
  pointer-events: auto;
  animation: toastIn 300ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.toast.is-leaving {
  animation: toastOut 220ms ease both;
}

.toast-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  margin-top: 1px;
  color: var(--ink);
  background: var(--yellow);
  border-radius: 50%;
}

.toast.is-error .toast-icon {
  color: var(--cream);
  background: var(--accent);
}

.toast-icon .icon {
  width: 11px;
  height: 11px;
}

/* =========================================================
   Animations
   ========================================================= */

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(60, 138, 98, 0.45);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(60, 138, 98, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(60, 138, 98, 0);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes viewIn {
  from {
    opacity: 0.4;
  }
  to {
    opacity: 1;
  }
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes tickerMove {
  to {
    transform: translateX(-50%);
  }
}

@keyframes numberBump {
  0% {
    transform: scale(1);
  }
  42% {
    transform: scale(1.09);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes overlayIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(5px);
  }
}

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 1120px) {
  .hero {
    gap: 40px;
    grid-template-columns: minmax(0, 1.1fr) minmax(330px, 0.9fr);
  }

  .admin-grid {
    grid-template-columns: minmax(0, 1fr) 330px;
  }

  .admin-candidate-row {
    gap: 11px;
  }

  .admin-cand-meta {
    max-width: 220px;
  }
}

@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 36px;
    padding-top: 62px;
  }

  .hero-copy {
    max-width: 760px;
  }

  .tally-card {
    min-height: 310px;
  }

  .tally-main {
    padding-top: 28px;
  }

  .tally-number {
    font-size: 5.4rem;
  }

  .candidate-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-lock {
    grid-template-columns: 1fr;
  }

  .lock-aside {
    min-height: 360px;
    padding: 42px 42px 36px;
  }

  .lock-aside h1 {
    margin-top: 34px;
    font-size: 46px;
  }

  .lock-points {
    display: none;
  }

  .lock-panel {
    padding: 46px 42px 50px;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .admin-side {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .admin-side .panel {
    height: 100%;
  }
}

@media (max-width: 760px) {
  .header-inner {
    min-height: 68px;
    padding: 10px 16px;
    gap: 10px;
  }

  .brand-mark {
    width: 33px;
    height: 33px;
  }

  .brand-mark svg {
    width: 23px;
    height: 23px;
  }

  .brand-copy strong {
    font-size: 21px;
  }

  .brand-copy small {
    display: none;
  }

  .nav-tab {
    min-height: 34px;
    padding: 6px 12px;
    font-size: 12px;
  }

  .header-right .status-pill {
    display: none;
  }

  .icon-button {
    width: 33px;
    height: 33px;
  }

  .hero {
    padding: 44px 20px 40px;
  }

  .hero::before {
    display: none;
  }

  .eyebrow {
    margin-bottom: 18px;
    font-size: 10px;
  }

  .hero h1 {
    font-size: clamp(3.1rem, 13.5vw, 4.4rem);
  }

  .hero-lede {
    margin-top: 22px;
    font-size: 13.5px;
  }

  .hero-actions {
    margin-top: 26px;
  }

  .hero-actions .btn {
    flex: 1;
    min-width: 150px;
  }

  .hero-note {
    margin-top: 23px;
  }

  .tally-card {
    min-height: 290px;
    padding: 22px 23px;
    border-radius: 18px;
  }

  .tally-meta strong {
    font-size: 20px;
  }

  .candidates-section {
    padding: 54px 20px 70px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
    padding-bottom: 19px;
  }

  .candidate-tools {
    width: 100%;
  }

  .search-field {
    flex: 1;
    width: auto;
  }

  .select-field {
    flex: 0 0 auto;
  }

  .candidate-grid {
    gap: 16px;
    padding-top: 22px;
  }

  .candidate-media {
    aspect-ratio: 4 / 3.5;
  }

  .candidate-body {
    padding: 16px;
  }

  .candidate-name {
    font-size: 22px;
  }

  .candidate-footer {
    margin-top: 14px;
    padding-top: 12px;
  }

  .vote-button {
    min-width: 87px;
    font-size: 11px;
  }

  .vote-meter-label span:last-child {
    display: none;
  }

  .empty-state {
    padding: 54px 20px;
  }

  .vote-footnote {
    margin-top: 26px;
  }

  .admin-view {
    padding: 34px 16px 64px;
  }

  .lock-aside {
    min-height: 290px;
    padding: 32px 28px 30px;
  }

  .lock-aside h1 {
    margin-top: 24px;
    font-size: 40px;
  }

  .lock-aside-lede {
    margin-top: 16px;
    font-size: 12px;
  }

  .lock-aside-mark {
    width: 64px;
    height: 64px;
    right: 21px;
    bottom: 19px;
  }

  .lock-panel {
    padding: 34px 28px 38px;
  }

  .lock-icon {
    width: 47px;
    height: 47px;
    margin-bottom: 22px;
  }

  .lock-panel h2 {
    font-size: 31px;
  }

  .admin-toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 22px;
  }

  .admin-toolbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .admin-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-card {
    min-height: 112px;
    padding: 16px;
  }

  .stat-value {
    font-size: 32px;
  }

  .stat-value.stat-text {
    font-size: 21px;
  }

  .admin-candidates-panel {
    padding: 20px 17px 9px;
  }

  .admin-candidate-row {
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas:
      "main status actions"
      "votes votes actions";
    gap: 9px 10px;
    padding: 14px 0;
  }

  .admin-cand-main {
    grid-area: main;
  }

  .admin-candidate-row > .switch {
    grid-area: status;
  }

  .vote-control {
    grid-area: votes;
    width: max-content;
  }

  .row-actions {
    grid-area: actions;
  }

  .admin-side {
    grid-template-columns: 1fr;
  }

  .footer-inner {
    padding: 32px 20px;
    align-items: flex-start;
    flex-direction: column;
    gap: 19px;
  }

  .footer-brand p {
    font-size: 16px;
  }

  .modal-overlay {
    padding: 12px;
    align-items: end;
  }

  .modal {
    max-height: calc(100vh - 24px);
    padding: 28px 22px 24px;
    border-radius: 18px;
  }

  .modal-head h2 {
    font-size: 28px;
  }

  .candidate-form-grid {
    margin-top: 20px;
    grid-template-columns: 1fr;
    gap: 19px;
  }

  .image-drop {
    aspect-ratio: 16 / 6.8;
  }

  .image-column {
    gap: 7px;
  }

  .image-drop-empty {
    gap: 3px;
  }

  .image-drop-empty .icon {
    margin-bottom: 0;
  }

  .footer-right {
    width: 100%;
    justify-content: space-between;
  }

  .toast-stack {
    right: 14px;
    bottom: 14px;
    left: 14px;
    align-items: stretch;
  }

  .toast {
    max-width: none;
  }
}

@media (max-width: 560px) {
  .candidate-grid {
    grid-template-columns: 1fr;
  }

  .candidate-media {
    aspect-ratio: 4 / 2.9;
  }

  .candidate-avatar {
    font-size: 4.5rem;
  }

  .candidate-grid .candidate-card:nth-child(n + 4) {
    display: flex;
  }

  .header-inner {
    grid-template-columns: auto 1fr auto;
  }

  .main-nav {
    justify-self: center;
  }

  .nav-tab {
    padding: 6px 9px;
    font-size: 11.5px;
  }

  .nav-tab .icon {
    width: 13px;
    height: 13px;
  }

  .brand-copy strong {
    font-size: 19px;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-actions .btn {
    width: 100%;
  }

  .candidate-tools {
    flex-wrap: wrap;
  }

  .select-field {
    width: 100%;
  }

  .select-field select {
    width: 100%;
  }

  .tally-meta {
    gap: 7px;
  }

  .tally-meta span {
    font-size: 9px;
  }

  .tally-meta strong {
    font-size: 18px;
  }

  .admin-stats {
    gap: 8px;
  }

  .stat-card {
    min-height: 102px;
    padding: 13px;
  }

  .stat-label {
    font-size: 10px;
  }

  .stat-value {
    font-size: 29px;
  }

  .stat-note {
    font-size: 9px;
  }

  .admin-toolbar-actions .btn {
    flex: 1;
  }

  .panel-head {
    flex-direction: column;
  }

  .admin-candidates-panel .panel-head {
    gap: 12px;
  }

  .admin-candidates-panel .panel-head .btn {
    width: 100%;
  }

  .admin-list-tools {
    flex-wrap: wrap;
  }

  .admin-list-tools .select-field {
    width: 100%;
  }

  .admin-candidate-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "main actions"
      "votes status";
  }

  .admin-candidate-row > .switch {
    justify-self: end;
  }

  .row-actions {
    justify-self: end;
  }

  .activity-item {
    align-items: flex-start;
  }
}

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