:root {
  color-scheme: light;
  --os-brand: #9a5a2f;
  --os-brand-hover: #7c4527;
  --os-brand-pressed: #66371f;
  --os-brand-dark: #2a221e;
  --os-brand-soft: #f3e3d4;
  --os-brand-pale: #fbf4ec;
  --os-brand-wash: #fff8f0;
  --os-panel: #fffdf9;
  --os-canvas: #f7f4ef;
  --os-navigation: #fcf9f5;
  --os-text: #2d2825;
  --os-muted: #5b514b;
  --os-border: #e6ddd4;
  --os-border-strong: #a48774;
  --os-focus: #b96934;
  --os-success: #2f7657;
  --os-success-soft: #e8f2ec;
  --os-warning: #a5542b;
  --os-disabled: #ead5c4;
  --shadow: 0 22px 48px rgba(42, 34, 30, 0.12);
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  margin: 0;
  color: var(--os-text);
  background:
    radial-gradient(circle at 12% 6%, rgba(243, 227, 212, 0.88), transparent 34%),
    var(--os-canvas);
}

button,
input {
  font: inherit;
}

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

.page-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--os-panel);
  box-shadow: var(--shadow);
}

.welcome-field {
  position: relative;
  min-height: 300px;
  padding: calc(24px + env(safe-area-inset-top)) 26px 72px;
  overflow: hidden;
  color: var(--os-brand-dark);
  background: linear-gradient(145deg, var(--os-brand-wash) 0%, var(--os-brand-soft) 100%);
}

.welcome-field::after {
  position: absolute;
  right: -74px;
  bottom: -98px;
  width: 236px;
  height: 236px;
  border: 44px solid rgba(154, 90, 47, 0.08);
  border-radius: 50%;
  content: "";
}

.wordmark {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 0;
}

.wordmark-en {
  color: var(--os-brand);
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.wordmark-cn {
  color: #8c603d;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.welcome-copy {
  position: relative;
  z-index: 1;
  margin-top: 28px;
}

.welcome-copy h1 {
  margin: 0;
  font-size: clamp(38px, 11vw, 54px);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.welcome-copy p {
  max-width: 23em;
  margin: 17px 0 0;
  color: var(--os-muted);
  font-size: 16px;
  line-height: 1.75;
}

.form-surface {
  position: relative;
  z-index: 2;
  min-height: 640px;
  margin-top: -34px;
  padding: 34px 24px calc(38px + env(safe-area-inset-bottom));
  border-radius: 28px 28px 0 0;
  background: var(--os-panel);
}

.form-heading {
  margin-bottom: 30px;
}

.form-heading h2 {
  margin: 0;
  color: var(--os-brand-dark);
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.35;
}

.form-heading p {
  margin: 10px 0 0;
  color: var(--os-muted);
  font-size: 13px;
  line-height: 1.65;
}

.form-heading p span {
  margin-right: 5px;
  color: var(--os-brand);
  font-size: 13px;
}

.text-field,
.choice-field {
  margin: 0 0 28px;
  padding: 0;
  border: 0;
}

.text-field label,
.choice-field legend {
  display: block;
  width: 100%;
  margin: 0 0 11px;
  padding: 0;
  color: var(--os-brand-dark);
  font-size: 16px;
  font-weight: 750;
  line-height: 1.45;
}

.text-field input {
  width: 100%;
  height: 54px;
  padding: 0 16px;
  border: 1px solid var(--os-border-strong);
  border-radius: 14px;
  outline: none;
  color: var(--os-text);
  background: var(--os-panel);
  font-size: 16px;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.text-field input::placeholder {
  color: var(--os-muted);
}

.text-field input:hover {
  border-color: var(--os-brand);
}

.text-field input:focus {
  border-color: var(--os-focus);
  box-shadow: 0 0 0 4px rgba(185, 105, 52, 0.15);
}

.text-field input[aria-invalid="true"] {
  border-color: var(--os-warning);
  background: var(--os-brand-wash);
}

.field-hint,
.field-error {
  min-height: 18px;
  margin: 7px 2px 0;
  font-size: 13px;
  line-height: 1.5;
}

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

.field-error {
  color: var(--os-warning);
  font-weight: 650;
}

.field-hint + .field-error:empty {
  min-height: 0;
  margin-top: 0;
}

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

.choice-option {
  position: relative;
  min-width: 0;
  cursor: pointer;
}

.choice-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
}

.choice-option span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 10px 11px;
  border: 1px solid var(--os-border-strong);
  border-radius: 14px;
  color: var(--os-text);
  background: var(--os-panel);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.35;
  text-align: center;
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.choice-option:hover span {
  border-color: var(--os-brand);
  background: var(--os-brand-wash);
}

.choice-option input:focus-visible + span {
  border-color: var(--os-focus);
  box-shadow: 0 0 0 4px rgba(185, 105, 52, 0.15);
}

.choice-option input:checked + span {
  border-color: var(--os-brand);
  color: var(--os-brand-wash);
  background: var(--os-brand);
  box-shadow: 0 8px 18px rgba(154, 90, 47, 0.2);
}

.scene-grid .wide {
  grid-column: 1 / -1;
}

.submit-zone {
  margin-top: 34px;
}

#submit-button,
.secondary-button {
  width: 100%;
  min-height: 56px;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 800;
  transition: transform 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}

#submit-button {
  position: relative;
  color: var(--os-brand-wash);
  background: var(--os-brand);
  box-shadow: 0 12px 24px rgba(154, 90, 47, 0.24);
}

#submit-button:hover:not(:disabled) {
  background: var(--os-brand-hover);
}

#submit-button:active:not(:disabled),
.secondary-button:active {
  transform: translateY(1px);
}

#submit-button:active:not(:disabled) {
  background: var(--os-brand-pressed);
}

#submit-button:focus-visible,
.secondary-button:focus-visible {
  outline: 4px solid rgba(185, 105, 52, 0.24);
  outline-offset: 2px;
}

#submit-button:disabled {
  cursor: not-allowed;
  color: var(--os-muted);
  background: var(--os-disabled);
  box-shadow: none;
}

#submit-button.is-loading .button-label {
  opacity: 0;
}

.button-progress {
  position: absolute;
  top: 50%;
  left: 50%;
  display: none;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border: 3px solid rgba(255, 248, 240, 0.4);
  border-top-color: var(--os-brand-wash);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

#submit-button.is-loading .button-progress {
  display: block;
}

.form-status {
  min-height: 20px;
  margin: 10px 4px 0;
  color: var(--os-warning);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.5;
  text-align: center;
}

.success-panel {
  padding: 48px 5px 20px;
  text-align: center;
  animation: success-reveal 480ms cubic-bezier(0.22, 1, 0.36, 1);
}

.success-panel[hidden] {
  display: none;
}

.success-mark {
  width: 70px;
  height: 70px;
  margin: 0 auto 24px;
}

.success-mark svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: none;
  stroke: var(--os-success);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.success-mark circle {
  fill: var(--os-success-soft);
  stroke: none;
}

.success-panel h2 {
  margin: 0;
  color: var(--os-brand-dark);
  font-size: 30px;
  letter-spacing: -0.03em;
}

.success-panel > p {
  margin: 14px auto 0;
  color: var(--os-muted);
  font-size: 15px;
  line-height: 1.75;
}

.success-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 34px 0 24px;
  padding: 18px 0;
  border-top: 1px solid var(--os-border);
  border-bottom: 1px solid var(--os-border);
  color: var(--os-muted);
  font-size: 14px;
}

.success-meta strong {
  color: var(--os-brand-dark);
  font-size: 16px;
}

.secondary-button {
  color: var(--os-brand-hover);
  background: var(--os-brand-soft);
}

.secondary-button:hover {
  background: var(--os-brand-pale);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes success-reveal {
  from {
    opacity: 0;
    transform: translateY(16px);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@media (min-width: 700px) {
  body {
    padding: 40px 0;
  }

  .page-shell {
    min-height: auto;
    border-radius: 28px;
    overflow: hidden;
  }

  .welcome-field {
    min-height: 320px;
  }
}

@media (max-width: 359px) {
  .welcome-field {
    padding-right: 20px;
    padding-left: 20px;
  }

  .form-surface {
    padding-right: 18px;
    padding-left: 18px;
  }

  .choice-grid {
    grid-template-columns: 1fr;
  }

  .scene-grid .wide {
    grid-column: auto;
  }
}

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