/* ── Reset & base ─────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f5f5f7;
  --bg-elevated: #ffffff;
  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #aeaeb2;
  --accent-should: #007aff;
  --accent-shouldnt: #ff3b30;
  --accent-should-soft: rgba(0, 122, 255, 0.12);
  --accent-shouldnt-soft: rgba(255, 59, 48, 0.12);
  --border: rgba(0, 0, 0, 0.06);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.04);
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --font-display: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, sans-serif;
  --font-text: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

body {
  font-family: var(--font-text);
  font-size: 16px;
  font-weight: 400;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.47;
  letter-spacing: -0.022em;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  font-optical-sizing: auto;
}

.hidden {
  display: none !important;
}

/* ── Layout ───────────────────────────────────────────────── */
.page {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  min-height: 100dvh;
  padding:
    calc(20px + var(--safe-top))
    calc(16px + var(--safe-right))
    calc(20px + var(--safe-bottom))
    calc(16px + var(--safe-left));
  max-width: 480px;
  margin: 0 auto;
}

/* ── Header ───────────────────────────────────────────────── */
.header {
  text-align: center;
  padding: 12px 0 24px;
  min-width: 0;
}

.header__badge {
  display: inline-block;
  font-family: var(--font-text);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.006em;
  text-transform: none;
  color: var(--accent-should);
  background: var(--accent-should-soft);
  padding: 6px 14px;
  border-radius: 100px;
  margin-bottom: 16px;
}

.header__title {
  font-family: var(--font-display);
  font-size: clamp(26px, 7vw, 34px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.12;
  margin-bottom: 8px;
  overflow-wrap: break-word;
}

.header__subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  font-weight: 400;
  letter-spacing: -0.016em;
  line-height: 1.47;
  max-width: 28ch;
  margin-inline: auto;
}

/* ── Card ─────────────────────────────────────────────────── */
.main {
  flex: 1;
  display: flex;
  align-items: flex-start;
}

.card {
  width: 100%;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  overflow: hidden;
}

.card__inner {
  padding: 22px 18px;
}

.card__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 12px;
}

.card__question {
  font-family: var(--font-display);
  font-size: clamp(18px, 4.8vw, 22px);
  font-weight: 600;
  letter-spacing: -0.028em;
  line-height: 1.3;
  margin-bottom: 22px;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

/* ── Vote buttons ─────────────────────────────────────────── */
.vote-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.vote-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-width: 0;
  min-height: 56px;
  padding: 16px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition:
    transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    background 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

.vote-btn:active {
  transform: scale(0.98);
}

.vote-btn--should:hover,
.vote-btn--should:focus-visible {
  border-color: var(--accent-should);
  background: var(--accent-should-soft);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.15);
  outline: none;
}

.vote-btn--shouldnt:hover,
.vote-btn--shouldnt:focus-visible {
  border-color: var(--accent-shouldnt);
  background: var(--accent-shouldnt-soft);
  box-shadow: 0 0 0 4px rgba(255, 59, 48, 0.15);
  outline: none;
}

.vote-btn__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 18px;
  font-weight: 600;
  flex-shrink: 0;
}

.vote-btn--should .vote-btn__icon {
  background: var(--accent-should-soft);
  color: var(--accent-should);
}

.vote-btn--shouldnt .vote-btn__icon {
  background: var(--accent-shouldnt-soft);
  color: var(--accent-shouldnt);
}

.vote-btn__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.vote-btn__label {
  font-family: var(--font-text);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.vote-btn__hint {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 400;
  letter-spacing: -0.014em;
  line-height: 1.35;
  overflow-wrap: break-word;
}

/* ── Results ──────────────────────────────────────────────── */
.results-section {
  animation: fadeIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.results__thanks {
  font-size: 15px;
  color: var(--text-secondary);
  letter-spacing: -0.016em;
  margin-bottom: 20px;
  text-align: center;
}

.result-bar {
  margin-bottom: 20px;
}

.result-bar__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}

.result-bar__label {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  min-width: 0;
}

.result-bar__percent {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.028em;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.result-bar__track {
  height: 10px;
  background: var(--bg);
  border-radius: 100px;
  overflow: hidden;
}

.result-bar__fill {
  height: 100%;
  border-radius: 100px;
  width: 0%;
  transition: width 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.result-bar__fill--should {
  background: linear-gradient(90deg, #007aff, #5ac8fa);
}

.result-bar__fill--shouldnt {
  background: linear-gradient(90deg, #ff3b30, #ff6961);
}

.result-bar__count {
  display: block;
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 6px;
}

.results__total {
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
  margin: 8px 0 20px;
  font-variant-numeric: tabular-nums;
}

.change-vote-btn {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--accent-should);
  font-family: var(--font-text);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
  touch-action: manipulation;
}

.change-vote-btn:active {
  transform: scale(0.98);
  background: #ebebed;
}

.change-vote-btn:hover {
  background: #ebebed;
}

/* ── Footer ───────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 24px 0 4px;
}

.footer p {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: -0.006em;
  color: var(--text-tertiary);
}

/* ── Larger phones ────────────────────────────────────────── */
@media (min-width: 390px) {
  body {
    font-size: 17px;
  }

  .page {
    padding-inline:
      calc(20px + var(--safe-left))
      calc(20px + var(--safe-right));
  }

  .card__inner {
    padding: 24px 22px;
  }

  .card__question {
    font-size: clamp(20px, 4.8vw, 24px);
    margin-bottom: 26px;
  }

  .header__title {
    font-size: clamp(30px, 7vw, 36px);
  }

  .header__subtitle {
    font-size: 17px;
    max-width: none;
  }

  .vote-btn__label {
    font-size: 17px;
  }

  .vote-btn__hint {
    font-size: 15px;
  }

  .results__thanks {
    font-size: 17px;
  }

  .result-bar__label {
    font-size: 17px;
  }

  .result-bar__percent {
    font-size: 20px;
  }

  .change-vote-btn {
    font-size: 17px;
  }
}

/* ── Tablet & desktop ─────────────────────────────────────── */
@media (min-width: 481px) {
  .page {
    padding:
      calc(48px + var(--safe-top))
      calc(24px + var(--safe-right))
      calc(48px + var(--safe-bottom))
      calc(24px + var(--safe-left));
  }

  .header {
    padding: 16px 0 40px;
  }

  .header__title {
    font-size: clamp(32px, 6vw, 40px);
  }

  .card__inner {
    padding: 36px 32px;
  }

  .card__question {
    font-size: clamp(22px, 4vw, 28px);
    margin-bottom: 28px;
  }

  .vote-buttons {
    flex-direction: row;
    gap: 14px;
  }

  .vote-btn {
    flex: 1;
    flex-direction: column;
    text-align: center;
    padding: 24px 16px;
    gap: 12px;
    min-height: auto;
  }

  .vote-btn__text {
    align-items: center;
    flex: initial;
  }
}

/* ── Very small phones (iPhone SE etc.) ───────────────────── */
@media (max-width: 359px) {
  .page {
    padding-inline:
      calc(12px + var(--safe-left))
      calc(12px + var(--safe-right));
  }

  .card__inner {
    padding: 18px 14px;
  }

  .card {
    border-radius: var(--radius-md);
  }

  .vote-btn__icon {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }

  .header__title {
    font-size: 24px;
  }
}

/* ── Number admin page ────────────────────────────────────── */
.header__badge--muted {
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.06);
}

.number-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.number-form__label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.016em;
}

.number-form__input {
  width: 100%;
  padding: 16px 18px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-family: var(--font-text);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  -webkit-appearance: none;
  appearance: none;
}

.number-form__input:focus {
  outline: none;
  border-color: var(--accent-should);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.15);
}

.number-form__status {
  margin-top: 4px;
  font-size: 14px;
  text-align: center;
}

.number-form__status--success {
  color: #248a3d;
}

.number-form__status--error {
  color: var(--accent-shouldnt);
}

.number-form__links {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.number-form__links-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}

.primary-btn {
  display: block;
  width: 100%;
  min-height: 50px;
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent-should);
  color: #fff;
  font-family: var(--font-text);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: opacity 0.2s ease, transform 0.15s ease;
  touch-action: manipulation;
}

.primary-btn:active {
  transform: scale(0.98);
  opacity: 0.9;
}

.primary-btn--inline {
  display: inline-block;
  width: auto;
  min-width: 140px;
}

.link-btn {
  display: block;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.016em;
  text-decoration: none;
  text-align: center;
  transition: background 0.2s ease;
}

.link-btn:hover {
  background: #ebebed;
}

/* ── Results page extras ──────────────────────────────────── */
.loading-state {
  text-align: center;
  padding: 32px 8px;
}

.loading-state__text {
  font-size: 15px;
  color: var(--text-secondary);
}

.error-state {
  text-align: center;
  font-size: 14px;
  color: var(--accent-shouldnt);
  margin-bottom: 16px;
}

.empty-state {
  text-align: center;
  padding: 24px 8px;
}

.empty-state__text {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 20px;
  margin-bottom: 24px;
  border-radius: var(--radius-md);
  background: var(--bg);
}

.stat-card__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.stat-card__value {
  font-family: var(--font-display);
  font-size: clamp(28px, 7vw, 36px);
  font-weight: 700;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.card__question--compact {
  margin-bottom: 20px;
}

.chart-donut {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 28px;
}

.chart-donut__svg {
  width: min(180px, 50vw);
  height: min(180px, 50vw);
  transform: rotate(-90deg);
}

.chart-donut__bg {
  fill: none;
  stroke: var(--bg);
  stroke-width: 14;
}

.chart-donut__segment {
  fill: none;
  stroke-width: 14;
  stroke-linecap: round;
  stroke-dasharray: 0 264;
  transition: stroke-dasharray 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.chart-donut__segment--should {
  stroke: var(--accent-should);
}

.chart-donut__segment--shouldnt {
  stroke: var(--accent-shouldnt);
}

.chart-donut__legend {
  display: flex;
  gap: 20px;
  margin-top: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.chart-donut__legend-item {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.014em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-donut__legend-item::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.chart-donut__legend-item--should::before {
  background: var(--accent-should);
}

.chart-donut__legend-item--shouldnt::before {
  background: var(--accent-shouldnt);
}

/* ── Reduced motion ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .vote-btn,
  .result-bar__fill,
  .results-section,
  .change-vote-btn,
  .chart-donut__segment {
    transition: none;
    animation: none;
  }
}
