:root {
  --navy: #071b3b;
  --navy-2: #0b2d5f;
  --blue: #1262a5;
  --cyan: #13a8d8;
  --gold: #f5c242;
  --white: #ffffff;
  --ink: #142033;
  --muted: #617087;
  --page: #eef3f8;
  --line: #d8e1eb;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--page);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  text-transform: uppercase;
}

button,
input {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 74px;
  padding: 12px clamp(20px, 5vw, 72px);
  background: var(--navy);
  border-bottom: 4px solid var(--gold);
}

.brand {
  display: block;
  width: 154px;
}

.brand img {
  display: block;
  width: 100%;
  height: auto;
}

.topbar-label {
  color: var(--white);
  font-size: 0.95rem;
  font-weight: 700;
}

.workspace {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0 60px;
}

.intro {
  max-width: 650px;
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 2.015rem;
  font-weight: 800;
  line-height: 1.35;
}

.intro h1 {
  margin: 0;
  color: var(--navy);
  font-size: 2.015rem;
  font-weight: 800;
  line-height: 1.35;
}

.intro p:last-child {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 2.015rem;
  font-weight: 800;
  line-height: 1.35;
}

.builder {
  display: grid;
  grid-template-columns: minmax(300px, 540px) minmax(250px, 330px);
  gap: clamp(28px, 6vw, 72px);
  align-items: start;
}

/* The poster always uses a 1080 x 1920 artboard. Only the complete preview scales. */
.poster-wrap {
  position: relative;
  width: 100%;
  height: 960px;
  filter: drop-shadow(0 24px 35px rgba(5, 24, 52, 0.2));
}

.poster {
  position: absolute;
  top: 0;
  left: 0;
  width: 1080px;
  height: 1920px;
  overflow: hidden;
  background: var(--white) url("./assets/colinha-background-b.webp?v=20260930-7") center / cover no-repeat;
  background-position: center;
  background-size: cover;
  color: var(--navy);
  transform: scale(0.5);
  transform-origin: top left;
}

.vote-list {
  position: absolute;
  top: 541px;
  right: 48px;
  display: flex;
  width: 700px;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.94);
  border: 0;
  border-radius: 22px;
  box-shadow: inset 0 0 0 2px #dbe3eb;
}

.vote-row,
.vote-row:first-child,
.vote-row:nth-child(2) {
  position: relative;
  width: 700px;
  height: 173px;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
  overflow: hidden;
  background: transparent;
  border: 0;
  border-bottom: 2px solid #dbe3eb;
  border-radius: 0;
  color: var(--navy);
}

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

.vote-row legend,
.office {
  position: absolute;
  top: 50%;
  left: 18px;
  display: block;
  width: 210px;
  margin: 0;
  padding: 0;
  color: var(--navy);
  font-size: 26px;
  font-weight: 900;
  line-height: 1.12;
  text-transform: uppercase;
  transform: translateY(-50%);
}

.fixed-vote {
  height: 158px;
}

.fixed-vote .office {
  width: 220px;
}

.vote-body {
  display: block;
}

.digits {
  position: absolute;
  top: 38px;
  right: 128px;
  display: flex;
  justify-content: flex-start;
  gap: 8px;
}

.digit,
.digits-fixed span {
  display: grid;
  width: 64px;
  height: 84px;
  min-width: 0;
  padding: 0;
  place-items: center;
  background: var(--white);
  border: 3px solid #141b37;
  border-radius: 9px;
  color: #0e1325;
  font-size: 44px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  caret-color: var(--blue);
  outline: none;
}

.digit:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 5px rgba(18, 98, 165, 0.2);
}

.digits-fixed {
  position: absolute;
  top: 24px;
  right: 20px;
  display: flex;
  gap: 8px;
}

.digits-fixed span {
  width: 72px;
  height: 84px;
  font-size: 46px;
}

[data-group="senador1"] .digit,
[data-group="senador2"] .digit {
  width: 76px;
}

.compact .digit {
  width: 84px;
}

.candidate-result {
  display: block;
}

.candidate-result img {
  position: absolute;
  top: 22px;
  right: 10px;
  display: block;
  width: 93px;
  height: 129px;
  object-fit: cover;
  object-position: center top;
  background: var(--white);
  border: 3px solid var(--blue);
  border-radius: 12px;
}

.candidate-copy {
  position: absolute;
  top: 125px;
  right: 136px;
  display: flex;
  width: 344px;
  height: 44px;
  min-width: 0;
  padding: 0 10px;
  align-items: center;
  justify-content: center;
  gap: 0;
  overflow: hidden;
  background: var(--white);
  border: 2px solid #dbe3eb;
  border-radius: 10px;
  line-height: 1;
}

.candidate-copy strong,
.candidate-party,
.candidate-separator {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.candidate-copy strong {
  flex: 1;
  font-size: 21px;
  font-weight: 900;
}

.candidate-party,
.candidate-separator {
  flex: 0 0 auto;
  color: #071b3b;
  font-size: 21px;
  font-weight: 400;
}

.candidate-party {
  max-width: 135px;
}

.candidate-separator {
  margin: 0 6px;
}

.candidate-copy.is-placeholder {
  color: transparent;
  user-select: none;
}

.candidate-copy.is-placeholder .candidate-party,
.candidate-copy.is-placeholder .candidate-separator {
  color: transparent;
}

.actions {
  position: sticky;
  top: 28px;
  display: grid;
  gap: 12px;
  padding-top: 8px;
}

.button {
  min-height: 52px;
  padding: 0 22px;
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 800;
  transition: transform 150ms ease, background-color 150ms ease, border-color 150ms ease;
}

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

.button:focus-visible {
  outline: 3px solid rgba(18, 98, 165, 0.35);
  outline-offset: 3px;
}

.button-primary {
  background: var(--gold);
  color: var(--navy);
}

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

.button-secondary {
  background: var(--navy);
  color: var(--white);
}

.button-secondary:hover {
  background: var(--navy-2);
}

.button-ghost {
  background: transparent;
  border-color: #b9c8d6;
  color: var(--navy);
}

.button-ghost:hover {
  background: var(--white);
  border-color: #8da3b8;
}

.privacy-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
  text-align: center;
}

.data-source {
  margin: 0;
  color: #738196;
  font-size: 0.76rem;
  line-height: 1.45;
  text-align: center;
}

.data-source a {
  color: var(--blue);
  font-weight: 700;
}

.toast {
  position: fixed;
  z-index: 20;
  right: 20px;
  bottom: 20px;
  max-width: min(360px, calc(100vw - 40px));
  padding: 13px 18px;
  background: var(--navy);
  border-left: 4px solid var(--gold);
  color: var(--white);
  font-size: 0.92rem;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 760px) {
  .topbar {
    min-height: 66px;
    padding-inline: 18px;
  }

  .brand {
    width: 130px;
  }

  .workspace {
    width: min(100% - 24px, 540px);
    padding-top: 30px;
  }

  .intro {
    margin-bottom: 22px;
    text-align: center;
  }

  .intro h1,
  .eyebrow,
  .intro p:last-child {
    font-size: 1.755rem;
  }

  .builder {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .actions {
    position: static;
  }
}

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