:root {
  color-scheme: light dark;
  --canvas: #f5f0e7;
  --surface: rgba(255, 253, 248, 0.84);
  --surface-strong: #fffdf8;
  --ink: #172019;
  --muted: #686e65;
  --line: rgba(29, 42, 32, 0.14);
  --line-strong: rgba(29, 42, 32, 0.24);
  --accent: #2f6a46;
  --accent-soft: #dff2d4;
  --accent-bright: #dffb91;
  --shadow: 0 30px 80px rgba(53, 43, 27, 0.11);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--canvas);
  color: var(--ink);
}

* { box-sizing: border-box; }

html { min-width: 320px; }

body {
  min-height: 100svh;
  margin: 0;
  background:
    radial-gradient(circle at 12% 6%, rgba(223, 251, 145, 0.38), transparent 28rem),
    radial-gradient(circle at 88% 88%, rgba(241, 187, 132, 0.22), transparent 30rem),
    var(--canvas);
}

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

.site-header {
  width: min(1120px, calc(100% - 40px));
  min-height: 76px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 680;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border-radius: 0.65rem;
  background: var(--ink);
  color: var(--accent-bright);
  font-size: 0.95rem;
  font-weight: 850;
  transform: rotate(-3deg);
}

.share-button {
  min-height: 42px;
  padding: 0.55rem 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 680;
  box-shadow: 0 5px 20px rgba(53, 43, 27, 0.04);
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.share-button:hover { border-color: var(--line-strong); background: var(--surface-strong); }
.share-button:active { transform: scale(0.97); }
.share-button svg { width: 1rem; height: 1rem; }

main {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(1.1rem, 4vw, 3.6rem) 0 clamp(3rem, 8vw, 7rem);
}

.poll {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: clamp(1.3rem, 3vw, 2rem);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.poll-intro { padding: clamp(1.3rem, 4vw, 2.65rem); }

.eyebrow {
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--accent);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.live-dot {
  width: 0.52rem;
  height: 0.52rem;
  border-radius: 50%;
  background: #4f9d68;
  box-shadow: 0 0 0 5px rgba(79, 157, 104, 0.12);
}

.title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
}

h1 {
  max-width: 800px;
  margin: 0;
  font-size: clamp(2.15rem, 6vw, 5.35rem);
  font-weight: 760;
  letter-spacing: -0.062em;
  line-height: 0.94;
}

.title-row p {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: clamp(0.95rem, 1.8vw, 1.12rem);
}

.total {
  flex: 0 0 auto;
  min-width: 5rem;
  padding-bottom: 0.15rem;
  text-align: right;
}

.total strong {
  display: block;
  font-size: clamp(1.8rem, 4vw, 3rem);
  letter-spacing: -0.06em;
  line-height: 0.9;
}

.total span { color: var(--muted); font-size: 0.8rem; }

.choice-visual {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: 100%;
  background: #2c2e26;
}

.choice-visual > img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1400 / 598;
  object-fit: cover;
}

.choice-hit-area {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.choice {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  min-width: 0;
  padding: clamp(0.65rem, 2vw, 1.4rem);
  border: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.5);
  background: linear-gradient(to top, rgba(12, 14, 11, 0.68), transparent 55%);
  color: white;
  cursor: pointer;
  transition: background 180ms ease, box-shadow 180ms ease;
}

.choice:last-child { border-right: 0; }
.choice:hover { background: linear-gradient(to top, rgba(12, 14, 11, 0.8), rgba(12, 14, 11, 0.04) 70%); }
.choice[aria-pressed="true"] { box-shadow: inset 0 0 0 5px var(--accent-bright); }
.choice:disabled { cursor: wait; }

.choice-label {
  padding: 0.46rem 0.67rem;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 999px;
  background: rgba(18, 20, 16, 0.4);
  font-size: clamp(0.72rem, 2vw, 1rem);
  font-weight: 760;
  letter-spacing: -0.02em;
  backdrop-filter: blur(9px);
}

.choice-check {
  position: absolute;
  top: clamp(0.6rem, 2vw, 1.2rem);
  right: clamp(0.6rem, 2vw, 1.2rem);
  display: grid;
  width: clamp(1.7rem, 4vw, 2.4rem);
  height: clamp(1.7rem, 4vw, 2.4rem);
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 50%;
  background: rgba(15, 18, 14, 0.26);
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 180ms ease, transform 180ms ease, background 180ms ease;
  backdrop-filter: blur(7px);
}

.choice-check svg { width: 58%; height: 58%; }
.choice[aria-pressed="true"] .choice-check { opacity: 1; transform: scale(1); background: var(--accent); }

.results {
  padding: clamp(1.1rem, 3vw, 1.85rem) clamp(1.3rem, 4vw, 2.65rem);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(0.8rem, 2.4vw, 2rem);
  border-bottom: 1px solid var(--line);
}

.result-copy {
  margin-bottom: 0.62rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.88rem;
}

.result-copy span { color: var(--muted); }
.result-copy strong { font-variant-numeric: tabular-nums; }

.result-track {
  display: block;
  overflow: hidden;
  height: 0.3rem;
  border-radius: 999px;
  background: var(--line);
}

.result-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.result.is-selected .result-copy span { color: var(--ink); font-weight: 720; }
.result.is-selected .result-track i { background: var(--accent-bright); box-shadow: inset 0 0 0 1px rgba(30, 58, 36, 0.18); }

.poll-footer {
  min-height: 70px;
  padding: 1rem clamp(1.3rem, 4vw, 2.65rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.connection {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.82rem;
}

.connection > span {
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 50%;
  background: #d39d42;
  box-shadow: 0 0 0 4px rgba(211, 157, 66, 0.12);
}

.connection[data-state="live"] > span,
.connection[data-state="ready"] > span { background: #4f9d68; box-shadow: 0 0 0 4px rgba(79, 157, 104, 0.12); }
.connection[data-state="error"] > span { background: #b85a4a; box-shadow: 0 0 0 4px rgba(184, 90, 74, 0.12); }
.toast {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: 1.25rem;
  max-width: calc(100% - 2rem);
  padding: 0.72rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: #172019;
  color: white;
  font-size: 0.83rem;
  font-weight: 680;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 0.8rem) scale(0.97);
  transition: opacity 180ms ease, transform 180ms ease;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.2);
}

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

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

@media (max-width: 640px) {
  .site-header, main { width: min(100% - 24px, 1120px); }
  .site-header { min-height: 64px; }
  main { padding-top: 0.7rem; }
  .brand > span:last-child { font-size: 0.78rem; }
  .share-button { min-width: 42px; justify-content: center; padding-inline: 0.7rem; }
  .share-button span { display: none; }
  .title-row { align-items: flex-end; gap: 1rem; }
  h1 { max-width: 12ch; }
  .title-row p { max-width: 23ch; }
  .total { min-width: 3.7rem; }
  .choice-visual > img { min-height: 168px; object-fit: cover; }
  .choice { padding: 0.55rem; }
  .choice-label { padding: 0.4rem 0.52rem; }
  .choice[aria-pressed="true"] { box-shadow: inset 0 0 0 3px var(--accent-bright); }
  .results { gap: 0.7rem; }
  .poll-footer { align-items: flex-start; flex-direction: column; gap: 0.45rem; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #11130f;
    --surface: rgba(25, 28, 23, 0.9);
    --surface-strong: #20241d;
    --ink: #f2f2e9;
    --muted: #a9aea4;
    --line: rgba(239, 244, 232, 0.13);
    --line-strong: rgba(239, 244, 232, 0.24);
    --accent: #99d499;
    --accent-soft: #20392a;
    --accent-bright: #dffb91;
    --shadow: 0 30px 90px rgba(0, 0, 0, 0.28);
  }

  body {
    background:
      radial-gradient(circle at 12% 6%, rgba(130, 167, 77, 0.14), transparent 28rem),
      radial-gradient(circle at 88% 88%, rgba(135, 78, 43, 0.12), transparent 30rem),
      var(--canvas);
  }

  .brand-mark { background: #f1f2e9; color: #26321f; }
  .result.is-selected .result-track i { background: var(--accent-bright); }
}

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