:root {
  --backdrop: 227 232 240;
  --badge: 255 250 232;
  --band: 209 43 51;
  --ink: 32 28 24;
  --muted: 112 106 96;
  --border: 226 213 176;
  --pink: 224 92 138;
  --blue: 79 126 214;

  --ease-out-expo: cubic-bezier(0.19, 1, 0.22, 1);
  --ease-out-quad: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.25rem;
  background: rgb(var(--backdrop));
  color: rgb(var(--ink));
  font-family: 'DM Sans', system-ui, sans-serif;
}

.page {
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.page-eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  color: rgb(var(--band));
  margin-bottom: 0.3rem;
}

.page-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.page-lede {
  font-size: 0.88rem;
  color: rgb(var(--muted));
  line-height: 1.5;
  margin-bottom: 1.75rem;
}

.badge {
  background: rgb(var(--badge));
  border-radius: 16px;
  overflow: hidden;
  box-shadow:
    0 24px 46px -22px rgb(32 28 24 / 0.35),
    0 2px 0 rgb(0 0 0 / 0.04);
  transform: rotate(-1.4deg);
  transition: transform 250ms var(--ease-out-quad);
}

.badge.is-stuck {
  animation: stick-down 460ms var(--ease-out-expo) both;
}

@keyframes stick-down {
  0% {
    transform: rotate(-1.4deg) scale(1);
  }
  35% {
    transform: rotate(2.5deg) scale(1.03);
  }
  65% {
    transform: rotate(-2.2deg) scale(0.99);
  }
  100% {
    transform: rotate(-1.4deg) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .badge.is-stuck {
    animation: none;
  }
}

.badge-band {
  background: rgb(var(--band));
  color: white;
  text-align: left;
  padding: 1.1rem 1.4rem 1rem;
}

.badge-band-main {
  display: block;
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
}

.badge-band-sub {
  display: block;
  font-size: 0.85rem;
  margin-top: 0.35rem;
  opacity: 0.9;
}

.badge-body {
  padding: 1.5rem 1.4rem 1.1rem;
}

.name-field {
  position: relative;
}

.name-input {
  width: 100%;
  border: none;
  border-bottom: 2.5px dashed rgb(var(--ink) / 0.25);
  background: none;
  outline: none;
  text-align: center;
  font-family: 'Permanent Marker', cursive;
  font-size: 2rem;
  color: rgb(var(--ink));
  padding: 0.3rem 0 0.5rem;
  transition: border-color 200ms ease;
}

.name-input::placeholder {
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  color: rgb(var(--muted) / 0.6);
}

.name-input:focus {
  border-bottom-color: rgb(var(--band));
  border-bottom-style: solid;
}

.suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 8px;
  right: 8px;
  z-index: 5;
  list-style: none;
  background: white;
  border: 1px solid rgb(var(--border));
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 14px 28px -16px rgb(0 0 0 / 0.35);
  opacity: 0;
  transform: translateY(-6px);
  transition:
    opacity 150ms var(--ease-out-quad),
    transform 150ms var(--ease-out-quad);
}

.suggestions.is-open {
  opacity: 1;
  transform: translateY(0);
}

.suggestion {
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
  color: rgb(var(--ink));
}

.suggestion:hover,
.suggestion.is-active {
  background: rgb(var(--band) / 0.08);
}

.readout[hidden],
.readout-empty[hidden] {
  display: none;
}

.readout {
  margin-top: 1.4rem;
}

.lean-bar {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: rgb(var(--ink) / 0.08);
  overflow: hidden;
  margin-bottom: 0.7rem;
}

.lean-fill {
  position: absolute;
  inset: 0;
  width: 0%;
  border-radius: 999px;
  transition: width 550ms var(--ease-out-expo);
}

.lean-marker {
  position: absolute;
  top: -3px;
  left: 0%;
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: rgb(var(--ink));
  transition: left 550ms var(--ease-out-expo);
}

.lean-label {
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
  animation: rise-in 320ms var(--ease-out-expo) both;
}

.lean-count {
  font-size: 0.75rem;
  color: rgb(var(--muted));
  animation: rise-in 320ms var(--ease-out-expo) 60ms both;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .lean-label,
  .lean-count {
    animation: none;
  }
}

.readout-empty {
  margin-top: 1.4rem;
  font-size: 0.85rem;
  color: rgb(var(--muted));
  font-style: italic;
}

.badge-fineprint {
  padding: 0 1.4rem 1.1rem;
  font-size: 0.68rem;
  line-height: 1.5;
  color: rgb(var(--muted) / 0.75);
}

.print-btn {
  margin-top: 1.5rem;
  padding: 0.75rem 1.5rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: white;
  background: rgb(var(--band));
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition:
    transform 150ms var(--ease-out-quad),
    background-color 200ms ease;
}

.print-btn:hover {
  background: rgb(184 36 43);
}

.print-btn:active {
  transform: scale(0.96);
}

@media (max-width: 420px) {
  .badge-band-main {
    font-size: 1.6rem;
  }

  .name-input {
    font-size: 1.6rem;
  }
}
