:root {
  --gold: #c9a227;
  --gold-dark: #a8841a;
  --gold-bg: #FDDA24;
  --ink: #1a1a1a;
  --muted: #5c5c5c;
  --border: #e4e4e4;
  --card: #fff;
  --page: #f3f3f3;
  --pill: #f0f0f0;
  --pill-active: #e8f4ea;
  --pill-border: #c8dccf;
  --star: #f5b301;
  --err: #b42318;
  --radius: 12px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  --content-max: 720px;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  line-height: 1.5;
}

.hero {
  background: linear-gradient(180deg, var(--gold-bg) 0%, #EBC91E 100%);
  padding: 2rem 1rem 4rem;
}

.hero-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  text-align: center;
}

.brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.brand-logo {
  display: block;
  width: auto;
  max-width: min(220px, 72vw);
  height: auto;
  max-height: 3rem;
}

.page {
  max-width: var(--content-max);
  margin: -2.5rem auto 3rem;
  padding: 0 1rem;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem 1.75rem;
}

.card-header h1 {
  margin: 0 0 1rem;
  font-size: 1.65rem;
  line-height: 1.25;
}

.intro p {
  margin: 0 0 0.75rem;
  color: var(--muted);
}

.section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.section h2 {
  margin: 0 0 0.25rem;
  font-size: 1.15rem;
}

.section .section-es {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.field {
  margin-bottom: 1.5rem;
}

.field label,
.field .field-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.field .label-es {
  display: block;
  color: var(--muted);
  font-weight: 400;
  font-size: 0.92rem;
  margin-bottom: 0.5rem;
}

.field .hint {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0 0 0.65rem;
}

.required::after {
  content: " *";
  color: var(--err);
}

input[type="text"],
input[type="email"],
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  font: inherit;
  background: #fff;
}

textarea {
  min-height: 5.5rem;
  resize: vertical;
}

.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pill-group input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pill-group label.at-pill,
.pill-group label:not(.at-pill) {
  display: inline-block;
  margin: 0;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-weight: 500;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.pill-group input:checked + label {
  font-weight: 600;
}

.pill-group label:not(.at-pill) {
  display: inline-block;
  margin: 0;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--pill);
  font-weight: 500;
  font-size: 0.88rem;
  cursor: pointer;
}

.pill-group input:checked + label:not(.at-pill) {
  background: var(--pill-active);
  border-color: var(--pill-border);
}

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.rating {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.rating button {
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.rating button.active {
  background: var(--star);
  border-color: #d9a006;
  color: #fff;
  font-weight: 700;
}

.rating button:hover {
  border-color: var(--gold);
}

.notice {
  background: #fafafa;
  border-left: 3px solid var(--gold);
  padding: 0.85rem 1rem;
  border-radius: 0 8px 8px 0;
  margin-bottom: 1rem;
}

.notice p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.registration-banner {
  background: #f7f9fc;
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.92rem;
}

.registration-banner.banner-warn {
  background: #fff8eb;
  border-color: #f0d9a8;
}

.identity-fields {
  margin-bottom: 0;
}

.identity-heading {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
}

.identity-intro {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
  margin: 0 0 1rem;
}

.identity-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1.25rem;
}

.identity-row .field {
  margin-bottom: 0;
}

.identity-row .field:only-child {
  grid-column: 1 / -1;
  max-width: 20rem;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 0.65rem 1.25rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.btn.primary {
  background: var(--ink);
  color: #fff;
}

.btn.primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--border);
}

.form-footnote {
  color: var(--err);
  font-size: 0.9rem;
  margin-top: 0.75rem;
}

.form-footnote.identity-privacy {
  color: var(--muted);
}

.field.invalid .field-label,
.field.invalid label:first-child {
  color: var(--err);
}

.success-card {
  text-align: center;
}

.success-card h2 {
  margin-top: 0;
}

.muted {
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.field.is-hidden {
  display: none;
}

.lang-nav {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.lang-label {
  font-size: 0.85rem;
  opacity: 0.85;
}

.lang-switch {
  display: flex;
  gap: 0.35rem;
}

.lang-btn {
  border: 1px solid rgba(0, 0, 0, 0.25);
  background: rgba(255, 255, 255, 0.35);
  border-radius: 6px;
  padding: 0.25rem 0.55rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.lang-btn.active {
  background: #fff;
  border-color: var(--ink);
}

.star-card {
  text-align: center;
  padding: 2.5rem 1.75rem;
}

.star-card h1 {
  margin: 0 0 2rem;
  font-size: 1.45rem;
  line-height: 1.35;
}

.star-rating {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.star-btn {
  border: none;
  background: none;
  font-size: 2.75rem;
  line-height: 1;
  color: #ddd;
  cursor: pointer;
  padding: 0.15rem;
  transition: color 0.15s, transform 0.1s;
}

.star-btn.active {
  color: var(--star);
}

@media (hover: hover) {
  .star-rating:hover .star-btn {
    color: var(--star);
  }

  .star-rating:hover .star-btn:hover ~ .star-btn {
    color: #ddd;
  }
}

.star-btn:active {
  transform: scale(1.08);
}

.star-card .btn.primary {
  min-width: 10rem;
}

.google-card,
.already-card,
.identity-card {
  text-align: center;
}

.google-card h2,
.already-card h2,
.identity-card h2 {
  margin-top: 0;
}

.google-stars {
  color: var(--star);
  font-size: 1.75rem;
  letter-spacing: 0.15rem;
  margin: 0.5rem 0 1.25rem;
}

.google-btn {
  display: inline-block;
  text-decoration: none;
  margin: 0.75rem 0 0.5rem;
  min-width: 14rem;
  font-size: 1.05rem;
}

.google-hint {
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.google-post {
  margin: 1rem 0 0;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink);
}

.google-closing {
  margin: 0 0 1.25rem;
  font-size: 0.98rem;
  line-height: 1.55;
  color: var(--ink);
  font-weight: 500;
}

.star-rating.is-loading .star-btn {
  opacity: 0.6;
  pointer-events: none;
}

.survey-intro {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 1rem;
}

.identity-card form {
  text-align: left;
  margin-top: 1.25rem;
}

.identity-card .form-actions {
  justify-content: center;
  border-top: none;
  padding-top: 0;
  margin-top: 1rem;
}

@media (max-width: 640px) {
  .identity-card {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-radius: 0;
    box-shadow: none;
    padding: 1.25rem 1rem 1.5rem;
    margin: 0;
  }

  .identity-card h2 {
    font-size: 1.25rem;
  }

  .identity-card p {
    font-size: 0.95rem;
    line-height: 1.45;
    color: var(--muted);
  }

  .identity-card .field + .field {
    margin-top: 0.75rem;
  }

  .identity-card .btn.primary {
    width: 100%;
  }
}

.pill-group--likert {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

.pill-group--stacked {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

.pill-group--likert .pill-option,
.pill-group--stacked .pill-option {
  position: relative;
  min-width: 0;
}

.pill-group--likert .pill-option label.at-pill,
.pill-group--stacked .pill-option label.at-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-size: 0.88rem;
  line-height: 1.25;
  text-align: center;
  white-space: normal;
}

@media (min-width: 641px) {
  :root {
    --content-max: 900px;
  }

  .pill-group--stacked {
    display: flex;
    flex-wrap: wrap;
  }

  .pill-group--stacked .pill-option label.at-pill {
    display: inline-block;
    width: auto;
  }

  .pill-group--likert {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.45rem;
  }

  .pill-group--likert .pill-option label.at-pill {
    min-height: 3rem;
    height: 100%;
    padding: 0.4rem 0.5rem;
    font-size: 0.8125rem;
    white-space: normal;
  }
}

@media (max-width: 540px) {
  .card {
    padding: 1.25rem 1rem;
  }

  .identity-row {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .identity-row .field:only-child {
    max-width: none;
  }

  .form-actions {
    flex-direction: column-reverse;
  }

  .btn {
    width: 100%;
  }
}

/* --- Mobile survey wizard (≤640px) --- */
@media (max-width: 640px) {
  html.wizard-mobile {
    height: 100%;
    overflow: hidden;
  }

  html.wizard-mobile body {
    height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  html.wizard-mobile .hero {
    flex-shrink: 0;
    padding: 0.55rem 1rem 0.65rem;
  }

  html.wizard-mobile .brand-logo {
    max-height: 2rem;
    max-width: min(180px, 60vw);
  }

  html.wizard-mobile .lang-nav {
    margin-top: 0.35rem;
  }

  html.wizard-mobile .page {
    flex: 1 1 auto;
    min-height: 0;
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
  }

  #formCard.is-wizard {
    --wizard-footer-h: calc(5.25rem + env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    padding: 0.65rem 1rem var(--wizard-footer-h);
    margin: 0;
    border-radius: 0;
    max-width: none;
    box-shadow: none;
  }

  #formCard.is-wizard .card-header,
  #formCard.is-wizard .survey-intro {
    display: none;
  }

  #formCard.is-wizard .survey-step.wizard-identity-omitted {
    display: none !important;
  }

  #formCard.is-wizard .survey-step .notice {
    display: none;
  }

  #formCard.is-wizard #feedbackForm {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  #formCard.is-wizard .survey-wizard-back {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
    margin: 0 0 0.35rem;
    padding: 0.25rem 0.35rem;
    border: none;
    background: transparent;
    color: var(--ink-muted, #555);
    font-size: 0.88rem;
    cursor: pointer;
  }

  #formCard.is-wizard .survey-wizard-back[hidden] {
    display: none;
  }

  #formCard.is-wizard .survey-wizard-viewport {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  #formCard.is-wizard #formSections {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  #formCard.is-wizard #formSections .section {
    display: contents;
  }

  #formCard.is-wizard .survey-wizard-viewport:has(> .survey-step--identity:not(.is-distant)) #formSections {
    flex: 0 0 auto;
  }

  #formCard.is-wizard .survey-wizard-viewport > .survey-step--identity:not(.is-distant) {
    flex: 1 1 auto;
    min-height: 0;
  }

  #formCard.is-wizard .section > h2 {
    display: none;
  }

  #formCard.is-wizard .section:not(:has(.survey-step)) {
    display: none;
  }

  #formCard.is-wizard .survey-step {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    padding: 0.25rem 0 0.5rem;
    transition: filter 0.25s ease, opacity 0.25s ease;
  }

  #formCard.is-wizard .survey-step.is-active {
    flex: 1 1 auto;
    min-height: 0;
    filter: none;
    opacity: 1;
    pointer-events: auto;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
  }

  #formCard.is-wizard .survey-step.is-before,
  #formCard.is-wizard .survey-step.is-after {
    flex: 0 0 2.25rem;
    height: 2.25rem;
    min-height: 0;
    filter: blur(5px);
    opacity: 0.35;
    pointer-events: none;
    overflow: hidden;
  }

  #formCard.is-wizard .survey-step.is-before {
    justify-content: flex-end;
  }

  #formCard.is-wizard .survey-step.is-after {
    justify-content: flex-start;
  }

  #formCard.is-wizard .survey-step.is-distant {
    display: none;
  }

  #formCard.is-wizard .survey-step .field-label {
    font-size: 1.1rem;
    line-height: 1.35;
    text-align: center;
    margin-bottom: 0.65rem;
  }

  #formCard.is-wizard .survey-step .hint {
    text-align: center;
    font-size: 0.88rem;
    margin-bottom: 0.5rem;
  }

  #formCard.is-wizard .survey-step--identity .identity-row {
    grid-template-columns: 1fr;
  }

  #formCard.is-wizard .survey-step--identity .field-label {
    text-align: center;
  }

  #formCard.is-wizard .survey-step textarea {
    min-height: 6.5rem;
    max-height: 28vh;
    font-size: 1rem;
  }

  #formCard.is-wizard .wizard-step-error {
    text-align: center;
    margin-top: 0.5rem;
  }

  #formCard.is-wizard .wizard-shake {
    animation: wizard-shake 0.45s ease;
  }

  @keyframes wizard-shake {
    0%,
    100% {
      transform: translateX(0);
    }
    20%,
    60% {
      transform: translateX(-6px);
    }
    40%,
    80% {
      transform: translateX(6px);
    }
  }

  #formCard.is-wizard .form-actions.wizard-hidden-actions {
    display: none;
  }

  #formCard.is-wizard .survey-wizard-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    padding: 0.65rem 1rem calc(0.65rem + env(safe-area-inset-bottom, 0px));
    background: var(--card, #fff);
    border-top: 1px solid var(--border, #e8e4dc);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
  }

  #formCard.is-wizard .survey-wizard-continue {
    width: 100%;
    margin-bottom: 0.65rem;
  }

  #formCard.is-wizard .survey-wizard-continue[hidden] {
    display: none;
  }

  #formCard.is-wizard .survey-wizard-continue.is-negative-continue {
    opacity: 0;
    transform: translateY(0.75rem);
    pointer-events: none;
  }

  #formCard.is-wizard .survey-wizard-continue.is-negative-continue.is-revealing {
    animation: wizard-continue-reveal 0.45s ease forwards;
    pointer-events: auto;
  }

  @keyframes wizard-continue-reveal {
    from {
      opacity: 0;
      transform: translateY(0.75rem);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  #formCard.is-wizard .survey-wizard-progress {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
  }

  #formCard.is-wizard .survey-wizard-progress-track {
    height: 4px;
    border-radius: 999px;
    background: var(--border, #e8e4dc);
    overflow: hidden;
  }

  #formCard.is-wizard .survey-wizard-progress-bar {
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--gold, #c9a227), var(--gold-light, #e4c65a));
    transition: width 0.3s ease;
  }

  #formCard.is-wizard .survey-wizard-progress-text {
    font-size: 0.78rem;
    color: var(--ink-muted, #666);
    text-align: center;
  }
}

@media (max-width: 640px) and (prefers-reduced-motion: reduce) {
  #formCard.is-wizard .survey-step {
    transition: opacity 0.2s ease;
  }

  #formCard.is-wizard .survey-step.is-before,
  #formCard.is-wizard .survey-step.is-after {
    filter: none;
    opacity: 0.5;
  }

}

@media (min-width: 641px) {
  .survey-wizard-back,
  .survey-wizard-footer {
    display: none !important;
  }
}
