:root {
  --paper: #fffaf6;
  --white: #ffffff;
  --ink: #171631;
  --muted: #6d6a7b;
  --line: rgba(31, 28, 66, 0.12);
  --cyan: #10c9e8;
  --blue: #1d65d8;
  --violet: #7555db;
  --pink: #f32788;
  --coral: #ff6f79;
  --yellow: #ffc923;
  --shadow: 0 24px 70px rgba(42, 33, 78, 0.13);
  --soft-shadow: 0 12px 36px rgba(42, 33, 78, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom);
  overscroll-behavior-y: none;
  color: var(--ink);
  background:
    linear-gradient(rgba(255, 255, 255, 0.88), rgba(255, 250, 246, 0.94)),
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent 39px,
      rgba(16, 201, 232, 0.045) 40px
    ),
    repeating-linear-gradient(
      0deg,
      transparent 0,
      transparent 39px,
      rgba(243, 39, 136, 0.04) 40px
    );
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible {
  outline: 4px solid rgba(16, 201, 232, 0.25);
  outline-offset: 3px;
}

img {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  filter: blur(12px);
  opacity: 0.22;
  pointer-events: none;
}

.ambient-one {
  top: -180px;
  right: -110px;
  background: radial-gradient(circle, var(--pink), transparent 68%);
}

.ambient-two {
  bottom: -190px;
  left: -130px;
  background: radial-gradient(circle, var(--cyan), transparent 68%);
}

.site-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 54px 0 36px;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  padding: 0 6px 38px;
}

.hero-copy {
  max-width: 780px;
}

.eyebrow,
.step-kicker {
  margin: 0 0 12px;
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.hero h1 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 20px;
  margin: 0;
  line-height: 0.86;
}

.chrome-text {
  color: transparent;
  background: linear-gradient(
    180deg,
    #f9ffff 0%,
    #62dded 28%,
    #7466da 52%,
    #ff4797 74%,
    #ff94a8 100%
  );
  background-clip: text;
  -webkit-background-clip: text;
  filter: drop-shadow(4px 5px 0 #1d255f);
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(4.6rem, 11vw, 8.4rem);
  letter-spacing: 0.025em;
  -webkit-text-stroke: 2px #1d255f;
}

.script-text {
  position: relative;
  z-index: 1;
  color: var(--pink);
  font-family: "Segoe Script", "Brush Script MT", cursive;
  font-size: clamp(2.7rem, 7vw, 5.4rem);
  font-style: italic;
  font-weight: 800;
  letter-spacing: -0.07em;
  text-shadow:
    2px 2px 0 #fff,
    5px 5px 0 rgba(117, 85, 219, 0.5);
  transform: rotate(-3deg);
}

.intro {
  max-width: 680px;
  margin: 28px 0 0;
  color: #555169;
  font-size: clamp(1rem, 2vw, 1.18rem);
  line-height: 1.65;
}

.vote-counter {
  flex: 0 0 auto;
  min-width: 154px;
  padding: 22px 24px;
  border: 1px solid rgba(29, 101, 216, 0.16);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--soft-shadow);
  text-align: center;
  backdrop-filter: blur(12px);
}

.vote-counter span {
  display: block;
  color: var(--pink);
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 2.35rem;
  line-height: 1;
}

.vote-counter small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.progress {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px 26px;
  border: 1px solid rgba(29, 101, 216, 0.11);
  border-radius: 24px 24px 0 0;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.progress-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #9692a4;
  white-space: nowrap;
}

.progress-item span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #f4f2f6;
  font-size: 0.82rem;
  font-weight: 900;
}

.progress-item strong {
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.progress-item.is-active,
.progress-item.is-complete {
  color: var(--ink);
}

.progress-item.is-active span {
  border-color: transparent;
  color: var(--white);
  background: linear-gradient(135deg, var(--pink), var(--violet));
  box-shadow: 0 7px 18px rgba(243, 39, 136, 0.28);
}

.progress-item.is-complete span {
  border-color: rgba(16, 201, 232, 0.3);
  color: var(--blue);
  background: rgba(16, 201, 232, 0.12);
}

.progress-line {
  width: min(120px, 10vw);
  height: 1px;
  margin: 0 18px;
  background: var(--line);
}

.step-panel,
.success-panel {
  position: relative;
  overflow: hidden;
  padding: clamp(30px, 6vw, 72px);
  border: 1px solid rgba(29, 101, 216, 0.11);
  border-top: 0;
  border-radius: 0 0 30px 30px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.step-panel::before,
.success-panel::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px;
  content: "";
  background: linear-gradient(
    90deg,
    var(--cyan),
    var(--violet),
    var(--pink),
    var(--yellow)
  );
}

.step-panel.is-active,
.success-panel {
  animation: panel-in 360ms ease both;
}

.section-heading {
  max-width: 720px;
  margin-bottom: 34px;
}

.section-heading h2,
.success-panel h2,
.dialog-header h2 {
  margin: 0;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.05;
  text-transform: uppercase;
}

.section-heading > p:last-child {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.style-grid,
.variant-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.choice-card {
  position: relative;
  overflow: hidden;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 24px;
  background: #f7f5f6;
  box-shadow: 0 9px 24px rgba(39, 32, 65, 0.08);
  cursor: pointer;
  text-align: left;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.choice-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 18px 40px rgba(39, 32, 65, 0.14);
}

.choice-card.is-selected {
  border-color: var(--pink);
  background: var(--white);
  box-shadow:
    0 0 0 5px rgba(243, 39, 136, 0.09),
    0 20px 45px rgba(39, 32, 65, 0.15);
}

.choice-image {
  display: block;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: #fbfafb;
}

.choice-image img {
  width: 100%;
  height: 100%;
  padding: 8px;
  object-fit: contain;
  transition: transform 450ms ease;
}

.choice-card:hover .choice-image img {
  transform: scale(1.025);
}

.choice-body {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 22px 24px 25px;
}

.choice-number {
  color: var(--blue);
  font-size: 0.69rem;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.choice-body strong {
  font-size: 1.28rem;
  line-height: 1.2;
}

.choice-body > span:last-child {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.choice-check {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 3px solid white;
  border-radius: 50%;
  color: white;
  background: linear-gradient(135deg, var(--pink), var(--violet));
  box-shadow: 0 6px 16px rgba(39, 32, 65, 0.24);
  opacity: 0;
  transform: scale(0.5);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.choice-card.is-selected .choice-check {
  opacity: 1;
  transform: scale(1);
}

.variant-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.variant-card .choice-image {
  aspect-ratio: 4 / 3;
}

.panel-actions,
.success-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 36px;
}

.panel-actions-right {
  justify-content: flex-end;
}

.panel-actions-left {
  justify-content: flex-start;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 22px;
  border-radius: 15px;
  cursor: pointer;
  font-weight: 900;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    opacity 180ms ease;
}

.primary-button {
  border: 0;
  color: white;
  background: linear-gradient(135deg, var(--pink), var(--violet));
  box-shadow: 0 12px 24px rgba(149, 48, 157, 0.25);
}

.primary-button:not(:disabled):hover,
.secondary-button:hover {
  transform: translateY(-2px);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
  box-shadow: none;
}

.secondary-button {
  border: 1px solid rgba(29, 101, 216, 0.18);
  color: var(--blue);
  background: rgba(29, 101, 216, 0.05);
}

.details-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(320px, 1.1fr);
  gap: clamp(28px, 6vw, 72px);
  align-items: start;
}

.selection-summary {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #f7f5f6;
  box-shadow: var(--soft-shadow);
}

.selection-summary img {
  width: 100%;
  aspect-ratio: 1.25;
  padding: 8px;
  object-fit: contain;
  background: #fbfafb;
}

.selection-summary div {
  padding: 22px 24px 24px;
}

.selection-summary span {
  color: var(--blue);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.selection-summary strong {
  display: block;
  margin-top: 7px;
  font-size: 1.3rem;
}

.selection-summary p {
  margin: 5px 0 0;
  color: var(--muted);
}

.field-label,
.size-fieldset legend {
  display: block;
  margin-bottom: 10px;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#voter-name {
  width: 100%;
  min-height: 56px;
  padding: 0 17px;
  border: 1px solid rgba(29, 101, 216, 0.2);
  border-radius: 15px;
  color: var(--ink);
  background: #fff;
  font-size: 1.05rem;
  box-shadow: inset 0 1px 0 rgba(29, 101, 216, 0.05);
}

#voter-name::placeholder {
  color: #aaa6b2;
}

.size-fieldset {
  padding: 0;
  margin: 28px 0 0;
  border: 0;
}

.size-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.size-grid button {
  min-height: 50px;
  padding: 8px 4px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #f7f5f6;
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 900;
}

.size-grid button:hover {
  border-color: rgba(243, 39, 136, 0.35);
}

.size-grid button.is-selected {
  border-color: var(--pink);
  color: white;
  background: linear-gradient(135deg, var(--pink), var(--violet));
  box-shadow: 0 8px 18px rgba(149, 48, 157, 0.2);
}

.privacy-note {
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

.form-error {
  min-height: 22px;
  margin: 17px 0 0;
  color: #b4234b;
  font-size: 0.88rem;
  font-weight: 700;
}

.submit-button {
  width: 100%;
  margin-top: 20px;
}

.success-panel {
  border-top: 1px solid rgba(29, 101, 216, 0.11);
  border-radius: 30px;
  text-align: center;
}

.success-icon {
  display: grid;
  width: 72px;
  height: 72px;
  margin: 0 auto 24px;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: linear-gradient(135deg, var(--cyan), var(--violet), var(--pink));
  box-shadow: 0 16px 34px rgba(98, 75, 184, 0.24);
  font-size: 2rem;
  font-weight: 900;
}

.success-panel > p:not(.step-kicker) {
  max-width: 640px;
  margin: 14px auto 0;
  color: var(--muted);
  line-height: 1.6;
}

.success-selection {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
}

.success-selection span {
  padding: 8px 12px;
  border: 1px solid rgba(29, 101, 216, 0.13);
  border-radius: 999px;
  color: var(--blue);
  background: rgba(16, 201, 232, 0.08);
  font-size: 0.84rem;
  font-weight: 800;
}

.success-actions {
  justify-content: center;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 6px 0;
}

.site-footer p {
  margin: 0;
  color: #8b8797;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.results-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  color: var(--blue);
  background: transparent;
  cursor: pointer;
  font-weight: 900;
}

.results-dialog {
  width: min(760px, calc(100% - 28px));
  max-height: min(850px, calc(100vh - 28px));
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 28px;
  background: #fffdfb;
  box-shadow: 0 35px 100px rgba(28, 24, 60, 0.33);
}

.results-dialog::backdrop {
  background: rgba(24, 21, 50, 0.58);
  backdrop-filter: blur(6px);
}

.dialog-header {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 30px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 251, 0.96);
  backdrop-filter: blur(12px);
}

.dialog-header .step-kicker {
  margin-bottom: 8px;
}

.dialog-header h2 {
  font-size: 2rem;
}

.dialog-close {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: white;
  cursor: pointer;
  font-size: 1.6rem;
  line-height: 1;
}

.results-content {
  padding: 28px 30px 34px;
}

.results-total {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 28px;
  color: var(--muted);
}

.results-total strong {
  color: var(--pink);
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 3.2rem;
  font-weight: 500;
  line-height: 1;
}

.results-group + .results-group {
  margin-top: 30px;
}

.results-group h3 {
  margin: 0 0 14px;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.result-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(150px, 2.2fr) 42px;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
}

.result-row span {
  overflow: hidden;
  font-size: 0.88rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-row strong {
  color: var(--blue);
  text-align: right;
}

.result-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #efedf1;
}

.result-bar i {
  display: block;
  width: var(--bar-width, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--violet), var(--pink));
}

.results-loading,
.results-empty {
  margin: 0;
  padding: 42px 0;
  color: var(--muted);
  text-align: center;
}

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

@media (max-width: 760px) {
  .site-shell {
    width: min(100% - 18px, 620px);
    padding-top: 18px;
  }

  .hero {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
    padding: 0 8px 20px;
  }

  .hero h1 {
    display: block;
  }

  .chrome-text,
  .script-text {
    display: block;
  }

  .script-text {
    width: fit-content;
    margin-top: 8px;
  }

  .chrome-text {
    font-size: clamp(3.8rem, 20vw, 5.4rem);
  }

  .script-text {
    font-size: clamp(2.55rem, 13vw, 4rem);
  }

  .intro {
    margin-top: 20px;
    font-size: 0.98rem;
    line-height: 1.52;
  }

  .vote-counter {
    display: flex;
    width: 100%;
    align-items: baseline;
    justify-content: center;
    gap: 10px;
    padding: 14px 18px;
  }

  .vote-counter small {
    margin: 0;
  }

  .progress {
    position: sticky;
    z-index: 12;
    top: max(6px, env(safe-area-inset-top));
    justify-content: space-between;
    padding: 12px 14px;
    border-radius: 18px 18px 0 0;
    backdrop-filter: blur(16px);
  }

  .progress-item {
    gap: 0;
  }

  .progress-item strong {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .progress-line {
    flex: 1;
    width: auto;
    margin: 0 8px;
  }

  .style-grid,
  .variant-grid,
  .details-layout {
    grid-template-columns: 1fr;
  }

  .step-panel,
  .success-panel {
    padding: 28px 14px 24px;
    border-radius: 0 0 22px 22px;
  }

  .section-heading {
    margin-bottom: 24px;
    padding: 0 4px;
  }

  .section-heading h2 {
    font-size: clamp(1.85rem, 10vw, 2.55rem);
  }

  .section-heading > p:last-child {
    margin-top: 10px;
    font-size: 0.92rem;
    line-height: 1.5;
  }

  .style-grid,
  .variant-grid {
    gap: 16px;
  }

  .variant-card .choice-image,
  .choice-image {
    aspect-ratio: 1 / 1.08;
  }

  .choice-image img {
    padding: 6px;
  }

  .choice-body {
    gap: 5px;
    padding: 16px 17px 18px;
  }

  .choice-body strong {
    font-size: 1.14rem;
  }

  .choice-body > span:last-child {
    font-size: 0.86rem;
    line-height: 1.4;
  }

  .choice-check {
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
  }

  #step-style .panel-actions,
  #step-variant .panel-actions {
    position: sticky;
    z-index: 10;
    bottom: max(8px, env(safe-area-inset-bottom));
    margin: 24px -4px -8px;
    padding: 9px;
    border: 1px solid rgba(29, 101, 216, 0.13);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.93);
    box-shadow: 0 14px 34px rgba(31, 28, 66, 0.18);
    backdrop-filter: blur(16px);
  }

  .panel-actions,
  .success-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .panel-actions .primary-button,
  .panel-actions .secondary-button,
  .success-actions .primary-button,
  .success-actions .secondary-button {
    width: 100%;
    min-height: 58px;
  }

  .panel-actions-right,
  .panel-actions-left {
    flex-direction: column;
  }

  .size-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }

  .size-grid button {
    min-height: 56px;
    font-size: 0.94rem;
  }

  #voter-name {
    min-height: 58px;
    font-size: 1rem;
  }

  .selection-summary {
    border-radius: 20px;
  }

  .selection-summary img {
    aspect-ratio: 1 / 1.05;
    padding: 6px;
    object-fit: contain;
    background: #fbfafb;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .result-row {
    grid-template-columns: minmax(105px, 1fr) minmax(90px, 1.4fr) 34px;
    gap: 8px;
  }

  .results-dialog {
    width: 100%;
    max-height: 90dvh;
    margin: auto 0 0;
    border-radius: 24px 24px 0 0;
  }

  .dialog-header {
    padding: 22px 18px 18px;
  }

  .results-content {
    padding: 22px 18px calc(28px + env(safe-area-inset-bottom));
  }
}

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