:root {
  --page-bg: #ffffff;
  --text-primary: #18181b;
  --text-secondary: #71717a;
  --text-subtle: #52525b;
  --text-tertiary: #a1a1aa;
  --border-standard: #d4d4d8;
  --card-surface: #f4f4f5;
  --elevated-surface: #e4e4e7;
  --purple-primary: #5c0f8b;
  --purple-soft: rgba(92, 15, 139, 0.12);
  --pink-highlight: #f472b6;
  --teal-success: #14b8a6;
  --teal-soft: rgba(20, 184, 166, 0.14);
  --pink-soft: rgba(244, 114, 182, 0.14);
  --orange: #f97316;
  --orange-soft: #fff5ee;
  --blue: #3b82f6;
  --blue-soft: #eff6ff;
  --green: #22c55e;
  --green-soft: #f0fdf4;
  --pink: #ec4899;
  --pink-soft-column: #fdf2f8;
  --purple-soft-column: #f5f3ff;
  --red: #ef4444;
  --red-soft: #fef2f2;
  --shadow-strong: 0 28px 72px rgba(55, 8, 82, 0.16);
  --shadow-soft: 0 18px 42px rgba(24, 24, 27, 0.08);
  --radius-shell: 34px;
  --radius-card: 24px;
  --radius-pill: 999px;
}

* {
  box-sizing: border-box;
}

html {
  background: #f8f5fc;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(92, 15, 139, 0.16), transparent 30%),
    radial-gradient(circle at bottom right, rgba(20, 184, 166, 0.12), transparent 22%),
    linear-gradient(180deg, #faf7ff 0%, #f4f1fb 100%);
  color: var(--text-primary);
  font-family: "Inter", system-ui, sans-serif;
}

body.has-modal-open {
  overflow: hidden;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: 16px;
  z-index: 20;
  transform: translateY(-200%);
  padding: 10px 14px;
  border-radius: 12px;
  background: #111827;
  color: white;
  font-weight: 600;
  text-decoration: none;
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

button,
input {
  font: inherit;
}

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

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

.page-chrome {
  position: relative;
  display: flex;
  min-height: 100vh;
  justify-content: center;
  gap: 48px;
  padding: 24px;
}

.page-chrome__glow {
  position: fixed;
  z-index: 0;
  width: 28rem;
  height: 28rem;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.6;
  pointer-events: none;
}

.page-chrome__glow--top {
  top: -8rem;
  left: -8rem;
  background: rgba(92, 15, 139, 0.14);
}

.page-chrome__glow--bottom {
  right: -10rem;
  bottom: -10rem;
  background: rgba(20, 184, 166, 0.12);
}

.app-shell {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: calc(100vh - 48px);
  width: min(100%, 402px);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(92, 15, 139, 0.08);
  border-radius: var(--radius-shell);
  background: var(--page-bg);
  box-shadow: var(--shadow-strong);
}

.screen {
  display: none;
  flex: 1;
  gap: 24px;
  padding: 28px 24px 24px;
  animation: screen-in 220ms ease;
}

.screen--active {
  display: flex;
  flex-direction: column;
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding-top: 24px;
  text-align: center;
}

.hero__icon-wrap {
  display: flex;
  justify-content: center;
}

.hero__title,
.screen-title {
  margin: 0;
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: clamp(2rem, 6vw, 2.15rem);
  font-weight: 800;
  line-height: 1.08;
}

.hero__subtitle,
.screen-subtitle {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.45;
}

.screen-title--center,
.screen-subtitle--center {
  text-align: center;
}

.countdown-card,
.ballot-card,
.score-box {
  border-radius: var(--radius-card);
}

.countdown-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px;
  background: var(--purple-primary);
  color: white;
  text-align: center;
}

.countdown-card__label,
.countdown-card__date,
.score-box__label,
.score-box__note {
  margin: 0;
}

.countdown-card__label {
  color: rgba(255, 255, 255, 0.64);
  font-size: 0.92rem;
  font-weight: 600;
}

.countdown-card__days {
  margin: 0;
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: clamp(2.2rem, 8vw, 2.6rem);
  font-weight: 800;
  line-height: 0.95;
}

.countdown-card__date {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.82rem;
}

.section-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-block--tight {
  gap: 10px;
}

.section-title,
.section-subtitle {
  margin: 0;
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
}

.section-subtitle {
  font-size: 1.05rem;
}

.section-subtitle--center {
  text-align: center;
}

.quick-links,
.column-legend,
.tips-list,
.results-list,
.result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quick-link,
.tip-card,
.secondary-button,
.column-pill,
.result-row {
  border: 0;
  background: transparent;
}

.quick-link {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border-radius: var(--radius-card);
  background: var(--card-surface);
  color: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.quick-link:hover,
.quick-link:focus-visible,
.primary-button:hover,
.primary-button:focus-visible,
.secondary-button:hover,
.secondary-button:focus-visible,
.back-button:hover,
.back-button:focus-visible,
.ballot-choice-tile:hover,
.ballot-choice-tile:focus-visible,
.nav-arrow:hover,
.nav-arrow:focus-visible {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.quick-link__body {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 2px;
}

.quick-link__title,
.result-row__title {
  font-size: 0.95rem;
  font-weight: 600;
}

.quick-link__text,
.result-row__text {
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.quick-link__chevron {
  color: var(--text-tertiary);
}

.icon-badge {
  display: inline-flex;
  height: 44px;
  width: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  flex: 0 0 auto;
}

.icon-badge--small {
  height: 40px;
  width: 40px;
  border-radius: 20px;
}

.icon-badge--hero {
  height: 72px;
  width: 72px;
  border-radius: 36px;
  color: var(--purple-primary);
  background: var(--purple-soft);
}

.peru-flag {
  display: inline-grid;
  grid-template-columns: repeat(3, 1fr);
  width: 34px;
  height: 24px;
  overflow: hidden;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(24, 24, 27, 0.08);
}

.peru-flag__stripe--red {
  background: #d91023;
}

.peru-flag__stripe--white {
  background: #ffffff;
}

.icon-badge--purple-soft {
  color: var(--purple-primary);
  background: var(--purple-soft);
}

.icon-badge--teal-soft {
  color: var(--teal-success);
  background: var(--teal-soft);
}

.icon-badge--pink-soft {
  color: var(--pink-highlight);
  background: var(--pink-soft);
}

.info-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: auto;
  padding: 18px;
  border-radius: var(--radius-card);
  background: var(--purple-soft);
  color: var(--purple-primary);
}

.info-alert p,
.tip-card p,
.practice-counter,
.practice-counter {
  margin: 0;
}

.info-alert p {
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.45;
}

.screen-header,
.intro-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 16px;
}

.screen-header--center {
  align-items: center;
  text-align: center;
}

.column-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  font-size: 0.82rem;
  font-weight: 600;
}

.column-pill__number {
  display: inline-flex;
  height: 28px;
  width: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: white;
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
}

.ballot-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  background: var(--card-surface);
}

.ballot-card__viewer-trigger {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.ballot-card__image-wrap {
  overflow: hidden;
  border: 1px solid var(--border-standard);
  border-radius: 14px;
  background: white;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.ballot-card__image {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  object-position: top center;
}

.ballot-card__hint,
.image-viewer__eyebrow,
.image-viewer__hint-copy {
  margin: 0;
}

.ballot-card__hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--purple-primary);
  font-size: 0.82rem;
  font-weight: 700;
}

.primary-button,
.secondary-button,
.back-button,
.nav-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
}

.primary-button {
  min-height: 48px;
  width: 100%;
  border: 0;
  border-radius: 24px;
  background: var(--purple-primary);
  color: white;
  font-weight: 600;
  text-decoration: none;
}

.primary-button--large {
  min-height: 56px;
  border-radius: 28px;
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 700;
}

.secondary-button {
  min-height: 52px;
  width: 100%;
  border: 1.5px solid var(--border-standard);
  border-radius: 26px;
  background: white;
  color: var(--text-primary);
  font-weight: 600;
  text-decoration: none;
}

.practice-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.back-button {
  border: 0;
  background: transparent;
  color: var(--text-primary);
  padding: 6px 0;
  font-weight: 600;
  justify-content: flex-start;
  text-decoration: none;
}

.seo-copy {
  padding: 20px;
  border-radius: var(--radius-card);
  background: #faf7ff;
  border: 1px solid rgba(92, 15, 139, 0.08);
}

.seo-copy__lead,
.faq-item p,
.site-footer__text,
.noscript-guide p,
.noscript-guide li {
  margin: 0;
  color: var(--text-subtle);
  font-size: 0.92rem;
  line-height: 1.55;
}

.seo-copy__list,
.noscript-guide ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
}

.faq-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.site-footer {
  padding: 0 24px 24px;
}

.site-footer__text {
  text-align: center;
}

.site-footer a,
.noscript-guide a {
  color: var(--purple-primary);
  font-weight: 600;
}

.noscript-guide {
  padding: 24px;
}

.zoom-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 12px;
  background: var(--purple-soft);
  color: var(--purple-primary);
  font-size: 0.76rem;
  font-weight: 600;
}

.practice-stage {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.column-header {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  padding: 10px 14px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: center;
}

.ballot-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--border-standard);
  border-radius: var(--radius-card);
  background: white;
  touch-action: pan-y;
}

.ballot-target {
  display: flex;
  justify-content: center;
  width: 100%;
  min-width: 0;
}

.choice-card {
  position: relative;
  display: flex;
  min-height: 150px;
  align-items: center;
  justify-content: center;
  padding: 14px;
  border: 1px solid var(--border-standard);
  border-radius: 20px;
  background: var(--card-surface);
}

.ballot-choice-grid {
  --practice-square-size: 94px;
  display: grid;
  width: fit-content;
  max-width: 100%;
  gap: 12px;
}

.ballot-choice-grid--president,
.ballot-choice-grid--2 {
  grid-template-columns: repeat(2, var(--practice-square-size));
}

.ballot-choice-grid--3 {
  grid-template-columns: repeat(3, var(--practice-square-size));
}

.ballot-choice-tile {
  overflow: hidden;
  width: var(--practice-square-size);
  height: var(--practice-square-size);
  min-height: var(--practice-square-size);
  border: 1.5px solid #27272a;
  border-radius: 5px;
  background: white;
  cursor: pointer;
}

.ballot-choice-tile--logo {
  background: var(--card-surface);
}

.ballot-choice-tile--photo {
  padding: 0;
}

.ballot-choice-tile.is-selected {
  border-color: var(--purple-primary);
  box-shadow: inset 0 0 0 1px rgba(92, 15, 139, 0.16);
}

.ballot-choice-tile__mark {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  color: rgba(220, 38, 38, 0.92);
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: clamp(3.2rem, 16vw, 4.5rem);
  font-style: italic;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
}

.ballot-choice-tile.is-selected .ballot-choice-tile__mark {
  display: flex;
}

.party-logo {
  width: min(100%, 84px);
  border-radius: 12px;
}

.candidate-photo {
  height: 100%;
  width: 100%;
  object-fit: cover;
}

.ballot-number-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.ballot-number-strip--inline {
  display: contents;
}

.ballot-number-strip--1 {
  grid-template-columns: minmax(0, 1fr);
}

.ballot-number-slot {
  display: flex;
  flex-direction: column;
  width: var(--practice-square-size);
  min-width: 0;
}

.ballot-number-slot__label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.ballot-number-slot__input {
  height: var(--practice-square-size);
  min-height: var(--practice-square-size);
  width: 100%;
  border: 1.5px solid #27272a;
  border-radius: 5px;
  background: white;
  color: var(--text-primary);
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: clamp(1.6rem, 7vw, 2rem);
  font-weight: 800;
  text-align: center;
  caret-color: var(--purple-primary);
}

.ballot-number-slot__input:focus {
  outline: none;
  border-color: var(--purple-primary);
  box-shadow: 0 0 0 4px rgba(92, 15, 139, 0.12);
}

.practice-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav-arrow {
  height: 40px;
  width: 40px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 20px;
}

.nav-arrow--muted {
  background: var(--elevated-surface);
  color: var(--border-standard);
}

.nav-arrow--primary {
  background: var(--purple-primary);
  color: white;
}

.nav-arrow[disabled] {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
  box-shadow: none;
}

.dots-row {
  display: flex;
  flex: 1;
  justify-content: center;
  gap: 8px;
}

.dot {
  height: 6px;
  width: 6px;
  border-radius: 6px;
  background: var(--elevated-surface);
  transition: width 160ms ease, background-color 160ms ease;
}

.dot.is-active {
  width: 24px;
}

.practice-counter {
  color: var(--text-tertiary);
  font-size: 0.82rem;
  text-align: center;
}

.tip-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: 18px;
  background: var(--card-surface);
  color: var(--text-primary);
}

.tip-card p {
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.3;
}

.result-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 8px 0 0;
}

.result-hero__circle {
  display: flex;
  height: 96px;
  width: 96px;
  align-items: center;
  justify-content: center;
  border-radius: 48px;
  background: var(--teal-success);
  color: white;
}

.result-hero__circle--warning {
  background: #f59e0b;
}

.result-hero__circle--danger {
  background: var(--red);
}

.result-hero__icon {
  width: 42px;
  height: 42px;
}

.results-list {
  gap: 12px;
}

.result-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: 18px;
}

.result-row--success {
  background: var(--green-soft);
}

.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: end center;
  padding: 20px 14px;
}

.image-viewer[hidden] {
  display: none;
}

.image-viewer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(24, 24, 27, 0.72);
  backdrop-filter: blur(10px);
}

.image-viewer__dialog {
  position: relative;
  z-index: 1;
  display: flex;
  max-height: min(92vh, 880px);
  width: min(100%, 720px);
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.28);
}

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

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

.image-viewer__eyebrow {
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.image-viewer__title {
  margin: 0;
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: 1.15rem;
  font-weight: 800;
}

.image-viewer__close,
.image-viewer__control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease,
    color 160ms ease;
}

.image-viewer__close {
  height: 42px;
  width: 42px;
  border-radius: 21px;
  background: var(--card-surface);
  color: var(--text-primary);
}

.image-viewer__close:hover,
.image-viewer__close:focus-visible,
.image-viewer__control:hover,
.image-viewer__control:focus-visible,
.ballot-card__viewer-trigger:hover .ballot-card__image-wrap,
.ballot-card__viewer-trigger:focus-visible .ballot-card__image-wrap {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.ballot-card__viewer-trigger:focus-visible {
  outline: none;
}

.image-viewer__controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.image-viewer__control {
  min-height: 40px;
  min-width: 96px;
  border-radius: 999px;
  padding: 0 16px;
  background: var(--card-surface);
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 700;
}

.image-viewer__control--primary {
  background: var(--purple-primary);
  color: white;
}

.image-viewer__hint-copy {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.4;
}

.image-viewer__viewport {
  overflow: auto;
  flex: 1;
  min-height: 0;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(92, 15, 139, 0.05), rgba(20, 184, 166, 0.05)),
    white;
  cursor: grab;
  user-select: none;
  -webkit-overflow-scrolling: touch;
}

.image-viewer__viewport.is-dragging {
  cursor: grabbing;
}

.image-viewer__image {
  width: calc(100% * var(--image-viewer-scale, 1.9));
  max-width: none;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}

@media (max-width: 540px) {
  .image-viewer {
    padding: 0;
  }

  .image-viewer__dialog {
    max-height: 100vh;
    width: 100%;
    border-radius: 28px 28px 0 0;
    padding: 18px 16px 16px;
  }

  .image-viewer__viewport {
    border-radius: 18px;
  }
}

.result-row--error {
  background: var(--red-soft);
}

.result-row__badge {
  display: inline-flex;
  height: 28px;
  width: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  color: white;
  flex: 0 0 auto;
}

.result-row__badge--success {
  background: var(--teal-success);
}

.result-row__badge--error {
  background: var(--red);
}

.result-row__body {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 2px;
}

.result-row__text--success {
  color: var(--teal-success);
}

.result-row__text--error {
  color: var(--red);
}

.score-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px;
  background: var(--card-surface);
  text-align: center;
}

.score-box__label,
.score-box__note {
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.score-box__value {
  margin: 0;
  color: var(--teal-success);
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: clamp(2.3rem, 8vw, 2.7rem);
  font-weight: 800;
  line-height: 1;
}

.icon {
  height: 1.1rem;
  width: 1.1rem;
  flex: 0 0 auto;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 5;
  width: min(calc(100% - 32px), 360px);
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(24, 24, 27, 0.92);
  color: white;
  font-size: 0.92rem;
  text-align: center;
  transform: translate(-50%, 120%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: transform 180ms ease;
}

.toast.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
  visibility: visible;
}

@media (min-width: 980px) {
  .page-chrome {
    align-items: center;
  }
}

@media (max-width: 520px) {
  .page-chrome {
    padding: 0;
  }

  .app-shell {
    min-height: 100vh;
    width: 100%;
    border: 0;
    border-radius: 0;
  }

  .page-chrome__glow {
    display: none;
  }
}
