:root {
  --color-flag-blue: #0038b8;
  --color-bg: #071c42;
  --color-surface: #0d2a5c;
  --color-surface-alt: #123568;
  --color-text: #f3f5f9;
  --color-muted: #9bb0d6;
  --color-accent: #ffffff;
  --color-accent-dark: #bcd4f5;
  --color-border: rgba(255, 255, 255, 0.16);
  --radius: 14px;
  --max-width: 760px;
  --font-serif: "Playfair Display", Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--color-text);
  line-height: 1.5;
  background-color: var(--color-bg);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(255, 255, 255, 0.05), transparent 45%),
    radial-gradient(circle at 88% 92%, rgba(61, 114, 224, 0.1), transparent 45%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72'%3E%3Cg fill='none' stroke='%23ffffff' stroke-width='1' opacity='0.05'%3E%3Cpolygon points='36,6 62,52 10,52'/%3E%3Cpolygon points='36,66 62,20 10,20'/%3E%3C/g%3E%3C/svg%3E");
  background-attachment: fixed;
  background-size: auto, auto, 72px 72px;
}

#app {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.25rem 1.25rem 3rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.site-header {
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, #123a74 0%, #051333 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  padding: 2.25rem 1.5rem 2rem;
  margin-bottom: 1.5rem;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.header-watermark-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 5.5rem;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.045);
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

.flag-badge {
  width: 44px;
  margin: 0 auto 0.9rem;
  position: relative;
  z-index: 1;
}

.flag-icon {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
}

.kicker {
  position: relative;
  z-index: 1;
  margin: 0 0 0.6rem;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-accent);
  font-weight: 600;
}

.site-header h1 {
  position: relative;
  z-index: 1;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.7rem;
  margin: 0 0 0.6rem;
  color: #ffffff;
  line-height: 1.25;
}

#site-tagline {
  position: relative;
  z-index: 1;
  margin: 0 auto;
  max-width: 32rem;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.9rem;
}

main {
  flex: 1;
}

.screen {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.hidden {
  display: none;
}

h2 {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.25rem;
  text-align: center;
  margin-top: 0;
  color: var(--color-text);
}

/* Language screen */
.language-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.lang-btn {
  padding: 1rem;
  font-size: 1.05rem;
  font-weight: 600;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}

.lang-btn:hover,
.lang-btn:focus-visible {
  border-color: var(--color-accent);
  background: rgba(255, 255, 255, 0.12);
}

.lang-btn:active {
  transform: scale(0.98);
}

/* Email screen */
#email-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

#email-subtitle {
  text-align: center;
  color: var(--color-muted);
}

input[type="email"] {
  padding: 0.85rem 1.15rem;
  font-size: 1rem;
  border: 1.5px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface-alt);
  color: var(--color-text);
  text-align: start;
}

input[type="email"]::placeholder {
  color: var(--color-muted);
}

input[type="email"]:focus {
  outline: none;
  border-color: var(--color-accent);
}

.error-text {
  color: #ff7a7a;
  font-size: 0.9rem;
  margin: 0;
}

.consent-label {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--color-muted);
  cursor: pointer;
  line-height: 1.4;
}

.consent-label input[type="checkbox"] {
  flex-shrink: 0;
  width: 1.1rem;
  height: 1.1rem;
  margin: 0.1rem 0 0;
  accent-color: var(--color-accent);
  cursor: pointer;
}

/* Avatars */
.avatar-circle {
  --avatar-color: #1e5fa8;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--avatar-color);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px var(--avatar-color);
}

.avatar-wrap {
  position: relative;
  display: inline-flex;
}

.avatar-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 22%;
  z-index: 2;
  box-shadow: 0 0 0 3px var(--avatar-color);
}

/* Candidate photo row on the language screen */
.candidates-teaser {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.5rem 1.75rem;
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}

.teaser-avatar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.teaser-avatar .avatar-circle {
  width: 96px;
  height: 96px;
  font-size: 1.4rem;
}

.teaser-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-muted);
}

/* Candidates preview (email screen) */
#candidates-preview {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--color-border);
}

#candidates-preview-heading {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin: 0 0 1.1rem;
}

.photo-credits {
  text-align: center;
  font-size: 0.68rem;
  color: var(--color-muted);
  margin: 1.25rem 0 0;
  opacity: 0.8;
}

.candidates-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem 1.1rem;
}

.candidate-item {
  --avatar-color: #1e5fa8;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  width: 92px;
  text-align: center;
}

.candidate-item .avatar-circle {
  width: 84px;
  height: 84px;
  font-size: 1.15rem;
}

.candidate-item .card-name {
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--color-text);
}

/* Buttons */
.primary-btn,
.secondary-btn {
  padding: 0.85rem 1.6rem;
  font-size: 1rem;
  border-radius: 999px;
  border: 1.5px solid transparent;
  cursor: pointer;
  font-weight: 700;
}

.primary-btn {
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-dark));
  color: var(--color-bg);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.primary-btn:hover:not(:disabled) {
  filter: brightness(0.96);
}

.primary-btn:disabled {
  background: #40485a;
  color: #8b93a6;
  box-shadow: none;
  cursor: not-allowed;
}

.secondary-btn {
  background: transparent;
  border-color: var(--color-border);
  color: var(--color-text);
}

.secondary-btn:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.step-back-btn {
  display: inline-block;
  background: none;
  border: none;
  padding: 0;
  margin: 0 0 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-muted);
  cursor: pointer;
}

.step-back-btn:hover {
  color: var(--color-accent);
}

.step-back-btn:empty {
  display: none;
}

/* Quiz screen */
.progress-wrap {
  margin-bottom: 1.5rem;
}

#progress-bar-outer {
  background: var(--color-border);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}

#progress-bar-inner {
  background: linear-gradient(90deg, var(--color-accent), var(--color-accent-dark));
  height: 100%;
  width: 0%;
  transition: width 0.2s ease;
}

#progress-label {
  text-align: center;
  color: var(--color-muted);
  font-size: 0.85rem;
  margin: 0.5rem 0 0;
}

.question-icon {
  width: 52px;
  height: 52px;
  margin: 1.25rem auto 0.75rem;
  border-radius: 50%;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

#question-text {
  margin: 0 0 1.5rem;
  font-size: 1.2rem;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.option-btn {
  padding: 0.9rem 1.1rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface-alt);
  color: var(--color-text);
  text-align: start;
  font-size: 1rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.option-btn:hover {
  border-color: var(--color-accent);
}

.option-btn.selected {
  border-color: var(--color-accent);
  background: rgba(255, 255, 255, 0.14);
  font-weight: 600;
}

.quiz-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 1.75rem;
  gap: 0.75rem;
}

.quiz-nav .primary-btn {
  flex: 1;
}

/* Results screen */
.winner-card {
  text-align: center;
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

.winner-eyebrow {
  margin: 0 0 1rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.winner-avatar {
  --avatar-color: #1e5fa8;
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.winner-avatar .avatar-circle {
  width: 108px;
  height: 108px;
  font-size: 1.6rem;
}

#winner-name {
  margin-bottom: 0.15rem;
}

#winner-party {
  margin: 0 0 0.75rem;
  color: var(--color-muted);
}

.winner-percent {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-accent);
  margin: 0 0 0.9rem;
}

#winner-description {
  color: var(--color-muted);
  max-width: 48ch;
  margin: 0 auto;
}

.why-section,
.other-section {
  margin-bottom: 1.5rem;
}

.why-section h3,
.other-section h3 {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  text-align: start;
  margin: 0 0 0.3rem;
}

#why-intro {
  color: var(--color-muted);
  font-size: 0.9rem;
  margin: 0 0 1rem;
}

.why-list,
.other-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.why-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.why-item-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.why-item-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.why-item-question {
  font-size: 0.92rem;
}

.why-item-answer {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--color-accent-dark);
}

.other-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.9rem;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.other-item .avatar-circle {
  width: 40px;
  height: 40px;
  font-size: 0.75rem;
}

.other-item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.other-item-name {
  font-size: 0.92rem;
  font-weight: 700;
}

.other-item-party {
  font-size: 0.78rem;
  color: var(--color-muted);
}

.other-item-percent {
  font-weight: 700;
  color: var(--color-accent-dark);
  flex-shrink: 0;
}

.share-section {
  text-align: center;
  margin-bottom: 1.5rem;
}

.whatsapp-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.6rem;
  border-radius: 999px;
  background: #25d366;
  color: #06210f;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  transition: filter 0.15s;
}

.whatsapp-btn:hover {
  filter: brightness(0.96);
}

.whatsapp-icon {
  width: 20px;
  height: 20px;
  fill: #06210f;
  flex-shrink: 0;
}

#restart-btn {
  display: block;
  width: 100%;
  margin-top: 1.75rem;
}

#disclaimer {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--color-border);
  color: var(--color-muted);
  font-size: 0.85rem;
}

#disclaimer h4 {
  margin: 0 0 0.4rem;
  font-size: 0.9rem;
  color: var(--color-text);
}

.flag-divider {
  height: 6px;
  margin-top: 2rem;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--color-flag-blue) 0%,
    var(--color-flag-blue) 30%,
    #ffffff 30%,
    #ffffff 70%,
    var(--color-flag-blue) 70%,
    var(--color-flag-blue) 100%
  );
  opacity: 0.35;
}

footer {
  text-align: center;
  color: var(--color-muted);
  font-size: 0.8rem;
  margin-top: 1rem;
}

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

  .header-watermark-text {
    font-size: 3.6rem;
  }
}
