:root {
  color-scheme: light;
  --ivory: #fbf7ef;
  --ivory-deep: #f4ecde;
  --surface: #fffdf9;
  --surface-strong: #ffffff;
  --cinnabar: #0b57d0;
  --cinnabar-dark: #063b8c;
  --cinnabar-soft: #e8f0fe;
  --gold: #d9a441;
  --gold-soft: #ead7ae;
  --ink: #332a25;
  --muted: #766b63;
  --line: #e9dfd1;
  --success: #3c8d5c;
  --danger: #b23a46;
  --shadow: 0 18px 50px rgba(82, 48, 28, 0.12);
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --font-ui: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --font-display: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--ivory);
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
label,
input[type="radio"] {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

.h5-page {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px 16px 48px;
  background:
    radial-gradient(circle at 8% 5%, rgba(200, 149, 63, 0.11), transparent 25%),
    radial-gradient(circle at 88% 15%, rgba(170, 33, 31, 0.06), transparent 24%),
    var(--ivory);
}

.invite-shell {
  width: min(100%, 430px);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(200, 149, 63, 0.32);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.promo-page {
  position: relative;
  overflow: hidden;
  background: var(--cinnabar);
}

.promo-poster {
  display: block;
  width: 100%;
  height: auto;
}

.promo-actions {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 2;
  width: min(100vw, 430px);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(11, 87, 208, 0), rgba(11, 87, 208, 0.96) 28%, var(--cinnabar) 100%);
  transform: translateX(-50%);
}

.promo-actions .primary-button {
  background: linear-gradient(135deg, #1d72e8, #06479f);
  box-shadow: 0 10px 22px rgba(3, 34, 91, 0.28);
}

.invite-hero {
  position: relative;
  min-height: 166px;
  padding: 34px 28px 40px;
  overflow: hidden;
  color: #fffaf0;
  text-align: center;
  background: #0b57d0 url("../images/invite-hero-blue-gold.png") center / cover no-repeat;
}

.hero-kicker {
  position: relative;
  z-index: 1;
  margin: 7px 0 0;
  color: #f7dec0;
  font-size: 13px;
  letter-spacing: 0.08em;
}

.invite-hero h1 {
  position: relative;
  z-index: 1;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(30px, 8.5vw, 38px);
  font-weight: 700;
  letter-spacing: 0.09em;
  line-height: 1.25;
  text-shadow: 0 2px 10px rgba(80, 10, 8, 0.25);
}

.registration-form {
  padding: 19px 20px 24px;
}

.form-section + .form-section {
  margin-top: 20px;
}

.form-section h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  color: var(--cinnabar-dark);
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.form-section h2::before,
.form-section h2::after {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-soft));
  content: "";
}

.form-section h2::after {
  background: linear-gradient(90deg, var(--gold-soft), transparent);
}

.field-row,
.choice-field,
.route-options {
  display: block;
  min-width: 0;
  margin: 0 0 12px;
  padding: 0;
  border: 0;
}

.field-label,
.choice-field legend {
  display: block;
  margin-bottom: 5px;
  color: #4a3d35;
  font-size: 14px;
  font-weight: 600;
}

.field-label b,
.choice-field legend b {
  margin-left: 3px;
  color: var(--cinnabar);
}

.field-row input,
.field-row textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.field-row input {
  height: 44px;
  padding: 0 14px;
}

.field-row textarea {
  min-height: 88px;
  padding: 10px 14px;
  resize: vertical;
}

.field-row input::placeholder,
.field-row textarea::placeholder {
  color: #b7aca3;
}

.field-row input:focus,
.field-row textarea:focus {
  border-color: rgba(170, 33, 31, 0.65);
  box-shadow: 0 0 0 3px rgba(170, 33, 31, 0.09);
}

.field-hint,
.field-error {
  display: block;
  min-height: 15px;
  margin-top: 3px;
  font-size: 12px;
}

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

.field-error {
  color: var(--danger);
}

.has-error input,
.has-error textarea,
.has-error .segmented-choice,
.has-error .route-card {
  border-color: rgba(181, 50, 45, 0.65);
}

.segmented-choice {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.segmented-choice label {
  position: relative;
}

.segmented-choice input,
.route-card > input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.segmented-choice span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  transition: 160ms ease;
}

.segmented-choice input:checked + span {
  border-color: var(--cinnabar);
  background: var(--cinnabar);
  color: #fff;
  box-shadow: 0 7px 16px rgba(170, 33, 31, 0.19);
}

.segmented-choice input:focus-visible + span,
.route-card input:focus-visible ~ .route-radio {
  outline: 3px solid rgba(170, 33, 31, 0.2);
  outline-offset: 2px;
}

.route-card {
  position: relative;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 22px;
  gap: 10px;
  align-items: center;
  min-height: 70px;
  margin-bottom: 8px;
  padding: 8px 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.route-radio {
  width: 20px;
  height: 20px;
  border: 1.5px solid #b8aa9e;
  border-radius: 50%;
  box-shadow: inset 0 0 0 4px #fff;
}

.route-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  overflow: hidden;
  border: 0;
  border-radius: 10px;
  background: #fffaf3;
  transition: transform 160ms ease;
}

.route-visual img {
  display: block;
  width: 52px;
  height: 52px;
  object-fit: cover;
}

.route-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.route-copy strong {
  font-size: 15px;
}

.route-copy small {
  color: var(--muted);
  font-size: 12px;
}

.route-card:has(input:checked) {
  border-color: rgba(200, 149, 63, 0.72);
  background: #fffaf1;
  transform: translateY(-1px);
}

.route-card input:checked ~ .route-radio {
  border-color: var(--cinnabar);
  background: var(--cinnabar);
}

.route-card input:checked ~ .route-visual {
  transform: scale(1.03);
}

.primary-button,
.secondary-button {
  width: 100%;
  border: 0;
  border-radius: var(--radius-sm);
  font-weight: 700;
}

.primary-button {
  position: relative;
  height: 50px;
  overflow: hidden;
  background: linear-gradient(135deg, #1267dc, #06479f);
  color: #fff9ec;
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.12em;
  box-shadow: 0 12px 24px rgba(148, 26, 24, 0.22);
}

.primary-button::before,
.primary-button::after {
  position: absolute;
  top: 50%;
  width: 42px;
  height: 1px;
  background: rgba(236, 199, 127, 0.7);
  content: "";
}

.primary-button::before { left: 16px; }
.primary-button::after { right: 16px; }

.primary-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.secondary-button {
  height: 46px;
  background: var(--cinnabar);
  color: #fff;
}

.form-message {
  display: none;
  margin: 8px 0 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.form-message.is-success,
.form-message.is-error {
  display: block;
}

.form-message.is-success {
  background: #edf7f0;
  color: #2e744a;
}

.form-message.is-error {
  background: #fff0ee;
  color: #9b2824;
}

.registration-form[hidden],
.submission-result[hidden] {
  display: none;
}

.submission-result {
  padding: 48px 28px 42px;
  text-align: center;
}

.result-mark {
  display: grid;
  width: 68px;
  height: 68px;
  margin: 0 auto 18px;
  place-items: center;
  border: 1px solid #e8b4ae;
  border-radius: 50%;
  background: #fff0ee;
  color: var(--danger);
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 700;
}

.submission-success .result-mark {
  border-color: #b9dcc3;
  background: #edf7f0;
  color: var(--success);
}

.submission-success .result-eyebrow {
  color: var(--success);
}

.result-eyebrow {
  margin: 0 0 6px;
  color: var(--danger);
  font-size: 12px;
  letter-spacing: 0.14em;
}

.submission-result h2 {
  margin: 0;
  color: var(--cinnabar-dark);
  font-family: var(--font-display);
  font-size: 26px;
}

.result-message {
  min-height: 48px;
  margin: 12px auto 26px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}

.result-actions {
  display: grid;
  gap: 10px;
}

.result-back-button {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 14px;
}

.result-note {
  margin: 22px 0 0;
  color: #a99b90;
  font-size: 12px;
}

.privacy-copy {
  margin-top: 12px;
  text-align: center;
}

.privacy-copy button {
  border: 0;
  background: transparent;
  color: var(--cinnabar);
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.privacy-copy p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.privacy-dialog {
  width: min(calc(100% - 32px), 420px);
  padding: 22px;
  border: 1px solid var(--gold-soft);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.privacy-dialog::backdrop {
  background: rgba(45, 30, 24, 0.56);
  backdrop-filter: blur(3px);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.dialog-head h2 {
  margin: 0;
  color: var(--cinnabar-dark);
  font-family: var(--font-display);
  font-size: 20px;
}

.dialog-head button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: var(--ivory-deep);
  color: var(--ink);
  font-size: 23px;
}

.privacy-dialog p {
  margin: 18px 0 22px;
  color: var(--muted);
  line-height: 1.8;
}

.honey-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 460px) {
  .h5-page {
    padding: 0;
  }

  .invite-shell {
    width: 100%;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .registration-form {
    padding: 17px 18px calc(26px + env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
