:root {
  --blue: #003a6d;
  --blue-dark: #00264d;
  --blue-soft: #eaf3fb;
  --yellow: #f6b50e;
  --yellow-dark: #dda00a;
  --white: #ffffff;
  --ink: #18324a;
  --muted: #607489;
  --line: #d8e2ec;
  --danger: #c83434;
  --shadow: 0 24px 56px rgba(0, 38, 77, 0.2);
  --font-display: "Arial Black", "Arial Narrow", Arial, sans-serif;
  --font-body: "Arial", "Helvetica Neue", sans-serif;
}

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

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--blue);
  color-scheme: light;
  font-family: var(--font-body);
  font-size: 16px;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--blue);
  color: var(--white);
  font-family: var(--font-body);
  line-height: 1.4;
}

button,
input {
  font: inherit;
}

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

a {
  color: inherit;
}

.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;
}

.shell {
  width: min(100%, 1080px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.shell--centered {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.site-header {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
}

.brand-form,
.link-form,
.new-query-form {
  margin: 0;
}

.brand-button {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.brand__icon {
  display: block;
  width: 5.25rem;
  height: 5.8rem;
  flex: 0 0 auto;
  background: center / contain no-repeat url("../images/ico-vote-marcos-juarez.png?v=20260904a");
  filter: drop-shadow(0 10px 12px rgba(0, 20, 45, 0.2));
}

.brand__name {
  color: var(--white);
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 0.84;
}

.content {
  width: min(100%, 470px);
  margin: 0 auto;
}

.content--lookup h1 {
  margin: 0.1em 0;
  color: var(--white);
  font-family: var(--font-display);
  font-size: clamp(3.2rem, 14vw, 4.8rem);
  font-weight: 900;
  letter-spacing: -0.065em;
  line-height: 0.95;
  text-align: center;
  text-transform: uppercase;
}

.lead {
  max-width: 29rem;
  margin: 1rem auto 1.4rem;
  color: var(--white);
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
}

.lookup-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.input-shell {
  display: flex;
  height: 4.7rem;
  align-items: center;
  overflow: hidden;
  border: 3px solid var(--blue-dark);
  border-radius: 1.3rem;
  background: #f7f8fa;
  box-shadow: 0 10px 28px rgba(0, 28, 57, 0.16);
}

.input-shell:focus-within {
  background: var(--white);
  box-shadow: 0 0 0 5px rgba(246, 181, 14, 0.38);
}

.input-shell input {
  width: 100%;
  height: 100%;
  padding: 0.8rem 1.2rem;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--blue-dark);
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 0.015em;
}

.input-shell input::placeholder {
  color: #718296;
  opacity: 1;
}

.button {
  display: inline-flex;
  min-height: 3.75rem;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.85rem 1.5rem;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1.05;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  transition: background-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(1px);
}

.button:focus-visible,
.button-link:focus-visible,
.text-link:focus-visible {
  outline: 4px solid var(--white);
  outline-offset: 3px;
}

.button--primary {
  background: var(--yellow);
  box-shadow: 0 12px 24px rgba(246, 181, 14, 0.3);
  color: var(--blue-dark);
}

.button--primary:hover {
  background: #ffc32e;
}

.button--primary:disabled {
  cursor: not-allowed;
  filter: grayscale(0.4);
  opacity: 0.48;
  transform: none;
}

.button--secondary {
  border: 2px solid rgba(255, 255, 255, 0.8);
  background: transparent;
  color: var(--white);
}

.form-error {
  margin: 0;
  padding: 0.75rem 0.9rem;
  border-radius: 0.8rem;
  background: var(--danger);
  color: var(--white);
  font-size: 0.88rem;
  font-weight: 700;
  text-align: center;
}

.messages {
  display: grid;
  gap: 0.5rem;
  margin: 0 0 1rem;
}

.message {
  padding: 0.85rem 1rem;
  border-radius: 1rem;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.25;
}

.message--error {
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: var(--danger);
  color: var(--white);
}

.panel {
  width: min(100%, 580px);
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 2.5rem);
  border-radius: 2rem;
  background: var(--white);
  box-shadow: var(--shadow);
  color: var(--blue-dark);
}

.panel h1 {
  margin: 0.35rem 0 0.75rem;
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 7vw, 2.65rem);
  letter-spacing: -0.035em;
  line-height: 1;
  text-transform: uppercase;
}

.panel > p {
  margin: 0 0 1.5rem;
  color: var(--muted);
}

.step-label,
.eyebrow,
.vote-label {
  color: var(--yellow-dark);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.095em;
  text-transform: uppercase;
}

.person-list {
  display: grid;
  gap: 0.8rem;
}

.person-option {
  cursor: pointer;
}

.person-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.person-option__body {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 1.1rem;
  border: 3px solid var(--line);
  border-radius: 1rem;
  background: #f8fafc;
}

.person-option__body strong {
  color: var(--blue-dark);
  font-size: 1.08rem;
}

.person-option__body span {
  color: var(--muted);
  font-size: 0.92rem;
}

.person-option input:checked + .person-option__body {
  border-color: var(--yellow);
  background: #fff9e8;
  box-shadow: 0 0 0 3px rgba(246, 181, 14, 0.22);
}

.person-option input:focus-visible + .person-option__body {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.text-link {
  display: block;
  width: max-content;
  max-width: 100%;
  margin: 1.25rem auto 0;
  color: var(--blue);
  font-size: 0.92rem;
  font-weight: 700;
  text-align: center;
}

.text-link--button {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-decoration: underline;
}

.survey-backdrop {
  min-height: 100vh;
  padding: 0;
  background: rgba(216, 224, 231, 0.96);
  color: var(--blue-dark);
}

.survey-card {
  width: min(100%, 810px);
  min-height: 100vh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--white);
}

.survey-card__header {
  display: flex;
  min-height: 4.75rem;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1rem;
  background: var(--blue);
}

.brand--compact {
  gap: 0.45rem;
}

.brand--compact .brand__icon {
  width: 2.8rem;
  height: 3.1rem;
  filter: none;
}

.brand--compact .brand__name {
  font-size: 1rem;
  line-height: 1;
}

.survey-card__body {
  padding: clamp(1.25rem, 5vw, 2.5rem);
}

.survey-card h1 {
  max-width: 36rem;
  margin: 0.35rem auto 0.6rem;
  color: var(--blue-dark);
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 6vw, 2.6rem);
  letter-spacing: -0.035em;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
}

.survey-card .step-label {
  display: block;
  text-align: center;
}

.survey-intro {
  max-width: 34rem;
  margin: 0 auto 1.5rem;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.35;
  text-align: center;
}

.survey-ballot {
  position: relative;
  display: grid;
  gap: 0.5rem;
  width: 100%;
  margin: 0 auto;
  /* The hotspot is the nib of the same icon used for the touch animation. */
  cursor: url("../images/marker.svg") 3 45, pointer;
}

.ballot-option__image {
  display: block;
  width: 100%;
  height: auto;
  overflow: hidden;
  pointer-events: none;
}

/* Crops and check coordinates live in ballot.py. Each label stays in normal
   flow so shuffling the options also moves the image and its selection mark. */
.ballot-option {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
  cursor: inherit;
}

.ballot-option__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: inherit;
}

.survey-ballot__marker {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  width: 48px;
  height: 48px;
  pointer-events: none;
  user-select: none;
}

.survey-ballot__marker[hidden] {
  display: none;
}

.ballot-option__input:focus-visible ~ .ballot-option__image {
  outline: 3px solid var(--blue);
  outline-offset: -3px;
}

.ballot-option__check {
  visibility: hidden;
  fill: none;
  stroke: #0753ac;
  stroke-width: 13;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ballot-option__input:checked ~ .ballot-option__image .ballot-option__check {
  visibility: visible;
}

.ballot-option--marking .ballot-option__check path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.survey-actions {
  display: flex;
  width: min(100%, 330px);
  flex-direction: column;
  gap: 0.85rem;
  margin: 1.75rem auto 0;
}

.button-link {
  align-self: center;
  padding: 0.35rem 0.7rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: underline;
}

.shell--result {
  display: flex;
  width: min(100%, 520px);
  flex-direction: column;
  justify-content: center;
  padding-top: 4.5rem;
}

.result-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4.4rem clamp(1rem, 4vw, 1.5rem) 2.2rem;
  border-radius: 2.25rem;
  background: var(--white);
  box-shadow: var(--shadow);
  color: var(--blue-dark);
}

.result-card__pin {
  position: absolute;
  top: 0;
  left: 50%;
  display: grid;
  width: 6.2rem;
  height: 6.2rem;
  place-items: center;
  border: 0.6rem solid var(--white);
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 12px 24px rgba(0, 38, 77, 0.18);
  color: var(--blue-dark);
  font-family: var(--font-display);
  font-size: 3.7rem;
  transform: translate(-50%, -50%) rotate(-4deg);
}

.result-card .eyebrow {
  margin: 0;
  text-align: center;
}

.result-card h1 {
  margin: 0.4rem 0 0;
  color: var(--blue-dark);
  font-family: var(--font-display);
  font-size: clamp(2rem, 8vw, 3rem);
  letter-spacing: -0.045em;
  line-height: 0.98;
  text-align: center;
  text-transform: uppercase;
}

.result-card__dni {
  margin: 0.55rem 0 1.6rem;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 700;
}

.vote-label {
  margin: 0 0 0.55rem;
}

.place {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: center;
  text-align: center;
}

.place strong {
  font-size: 1.4rem;
  line-height: 1.05;
  text-transform: uppercase;
}

.place span {
  color: var(--muted);
}

.voting-map {
  position: relative;
  width: 100%;
  margin: 1.35rem 0 0;
}

.voting-map__frame {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--blue-soft);
}

.voting-map img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 9 / 4;
  object-fit: cover;
}

.voting-map__attribution {
  position: absolute;
  right: 0.5rem;
  bottom: 0.5rem;
  z-index: 1;
  padding: 0.12rem 0.28rem;
  border-radius: 0.22rem;
  background: rgba(255, 255, 255, 0.88);
  color: #315270;
  font-size: 0.58rem;
  line-height: 1.2;
  text-decoration: none;
}

.mesa-order {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  margin-top: 1.6rem;
}

.mesa-order > div {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  text-transform: uppercase;
}

.mesa-order span {
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.07em;
}

.mesa-order strong {
  font-size: 1.75rem;
}

.result-actions {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 0.75rem;
  margin-top: 1.35rem;
}

.new-query-form .button {
  width: 100%;
  height: 100%;
}

.panel--error form .button {
  width: 100%;
}

@media (min-width: 620px) {
  .shell {
    padding-right: 2rem;
    padding-left: 2rem;
  }

  .survey-backdrop {
    padding: 3.75rem 1.5rem;
  }

  .survey-card {
    min-height: 0;
    border-radius: 1.5rem;
    box-shadow: 0 28px 80px rgba(0, 38, 77, 0.2);
  }

  .survey-card__header {
    border-radius: 1.5rem 1.5rem 0 0;
  }
}

@media (max-width: 420px) {
  .brand__icon {
    width: 4.7rem;
    height: 5.2rem;
  }

  .result-actions {
    grid-template-columns: 1fr;
  }
}

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

@media print {
  body,
  html {
    background: var(--white);
  }

  .shell--result {
    width: 100%;
    min-height: auto;
    padding: 1rem;
  }

  .result-card {
    border: 2px solid var(--line);
    box-shadow: none;
  }

  .result-actions {
    display: none;
  }
}

.voting-map__attribution{display: none !important;}
