:root {
  --bg: #e8f4fc;
  --bg-deep: #d4ebf8;
  --card: #ffffff;
  --primary: #2b7bb9;
  --primary-hover: #236899;
  --primary-soft: #e3f0f9;
  --text: #1a2b3c;
  --muted: #5a6f82;
  --border: #c5ddee;
  --border-solid: #c5ddee;
  --danger: #c0392b;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(43, 123, 185, 0.1);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg) 0%, #f5fafd 40%, var(--bg-deep) 100%);
  line-height: 1.5;
}

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.25rem 1rem calc(5.5rem + var(--safe-b));
}

.header {
  text-align: center;
  margin-bottom: 1rem;
}

.brand {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.header h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.35rem, 4vw, 1.75rem);
  font-weight: 700;
  color: var(--primary);
}

.subtitle {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.6;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* steps */
.steps {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  padding: 0.25rem 0 1rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.steps::-webkit-scrollbar {
  display: none;
}

.step-dot {
  flex: 1 0 auto;
  min-width: 2.5rem;
  text-align: center;
  font-size: 0.7rem;
  color: var(--muted);
  border: none;
  background: transparent;
  padding: 0;
  cursor: default;
  transition: color 0.3s ease;
}

.step-dot .num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  margin: 0 auto 0.25rem;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--border-solid);
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--muted);
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease,
    transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.step-dot.active .num {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  transform: scale(1.08);
}

.step-dot.done .num {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}

.step-dot .label {
  display: none;
}

@media (min-width: 640px) {
  .step-dot .label {
    display: block;
    white-space: nowrap;
  }
}

/* card */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.15rem 1.5rem;
  border: 1px solid rgba(43, 123, 185, 0.12);
  overflow: hidden;
  transition: box-shadow 0.35s ease;
}

.panel {
  display: none;
  opacity: 0;
}

.panel.is-active {
  display: block;
  animation: panelIn 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.panel.is-active.dir-back {
  animation-name: panelInBack;
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translate3d(16px, 8px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes panelInBack {
  from {
    opacity: 0;
    transform: translate3d(-12px, 6px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

.panel h2 {
  margin: 0 0 1rem;
  font-size: 1.15rem;
  color: var(--primary);
}

.hidden {
  display: none !important;
}

.start-wrap {
  margin-top: 1.5rem;
  text-align: center;
}

.btn.start {
  background: transparent;
  color: var(--primary);
  border: 1px solid rgba(43, 123, 185, 0.35);
  font-weight: 500;
  min-width: 9rem;
  padding: 0.6rem 1.4rem;
  min-height: 2.5rem;
  border-radius: 999px;
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.2s ease;
}

.btn.start:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
}

.btn.start:active {
  transform: scale(0.98);
}

.tips {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.tips li {
  margin-bottom: 0.5rem;
}

.privacy {
  margin: 1rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--primary-soft);
  padding: 0.75rem 1rem;
  border-radius: 8px;
}

.hint {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.req {
  color: var(--danger);
}

/* form */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem 1rem;
}

@media (min-width: 560px) {
  .grid {
    grid-template-columns: 1fr 1fr;
  }
  .field.full {
    grid-column: 1 / -1;
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
}

.field input,
.field select,
.field textarea,
.asset-row select,
.repeat-item input,
.repeat-item select {
  font: inherit;
  font-weight: 400;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border-solid);
  border-radius: 8px;
  background: #fafcfe;
  color: var(--text);
  width: 100%;
  min-height: 2.75rem;
  appearance: auto;
}

.field textarea {
  min-height: 4.5rem;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.asset-row select:focus,
.repeat-item input:focus,
.repeat-item select:focus {
  outline: 2px solid rgba(43, 123, 185, 0.35);
  border-color: var(--primary);
  background: #fff;
}

.field input.invalid,
.field select.invalid,
.field textarea.invalid,
.asset-row select.invalid,
.repeat-item input.invalid,
.repeat-item select.invalid,
.yesno.invalid {
  border-color: var(--danger);
}

.yesno.invalid {
  box-shadow: inset 0 0 0 1px var(--danger);
}

.field input::placeholder,
.field textarea::placeholder {
  color: #9aafc0;
}

.mt {
  margin-top: 1.25rem;
}

/* yes/no */
.yesno {
  border: 1px solid var(--border-solid);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin: 0 0 0.85rem;
  background: #fafcfe;
}

.yesno legend {
  padding: 0 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.yesno > label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-right: 1.25rem;
  margin-top: 0.35rem;
  font-size: 0.95rem;
  cursor: pointer;
}

.yesno input[type="radio"] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--primary);
}

.expand {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  margin-top: 0;
  padding-top: 0;
  border-top: 1px dashed transparent;
  transition: max-height 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.28s ease, margin 0.28s ease, padding 0.28s ease,
    border-color 0.28s ease;
}

.expand.is-open {
  max-height: 28rem;
  opacity: 1;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top-color: var(--border-solid);
}

/* repeat rows */
.repeat-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 0.75rem;
}

.repeat-item {
  border: 1px solid var(--border-solid);
  border-radius: 10px;
  padding: 0.85rem;
  background: #fafcfe;
  position: relative;
}

.repeat-item .item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.65rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
}

.repeat-item .remove {
  border: none;
  background: transparent;
  color: var(--danger);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0.25rem 0.4rem;
}

.repeat-item .grid {
  gap: 0.65rem;
}

.row-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 400;
  margin-top: 0.35rem;
}

/* assets */
.asset-table {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.asset-head,
.asset-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.4rem;
}

.asset-head {
  display: none;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.asset-row {
  border: 1px solid var(--border-solid);
  border-radius: 10px;
  padding: 0.75rem;
  background: #fafcfe;
}

.asset-row > span:first-child {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.asset-sel {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
}

.asset-tag {
  display: inline-block;
}

@media (min-width: 560px) {
  .asset-head,
  .asset-row {
    grid-template-columns: 1.4fr 1fr 1fr;
    align-items: center;
    gap: 0.75rem;
  }

  .asset-head {
    display: grid;
    padding: 0 0.75rem;
  }

  .asset-row > span:first-child {
    margin-bottom: 0;
  }

  .asset-tag {
    display: none;
  }
}

/* summary */
.summary {
  font-size: 0.9rem;
}

.summary-block {
  margin-bottom: 1rem;
  border: 1px solid var(--border-solid);
  border-radius: 10px;
  overflow: hidden;
}

.summary-block h3 {
  margin: 0;
  padding: 0.55rem 0.85rem;
  font-size: 0.9rem;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.summary-block h3 button {
  border: none;
  background: transparent;
  color: var(--primary);
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: underline;
}

.summary-block dl {
  margin: 0;
  padding: 0.5rem 0.85rem 0.75rem;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 0.75rem;
}

.summary-block dt {
  color: var(--muted);
  font-size: 0.8rem;
}

.summary-block dd {
  margin: 0;
  font-size: 0.85rem;
  word-break: break-word;
}

.done-box {
  text-align: center;
  padding: 2rem 0.5rem;
}

.done-box h2 {
  color: var(--primary);
}

.done-box p {
  color: var(--muted);
}

.form-error {
  margin: 1rem 0 0;
  padding: 0.65rem 0.85rem;
  background: #fdecea;
  color: var(--danger);
  border-radius: 8px;
  font-size: 0.9rem;
}

/* footer nav */
.footer-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  padding: 0.55rem 1rem calc(0.55rem + var(--safe-b));
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(43, 123, 185, 0.12);
  z-index: 20;
  transform: translateY(0);
  opacity: 1;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.3s ease, visibility 0.3s;
}

.footer-nav.is-intro,
.footer-nav[hidden] {
  transform: translateY(110%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.footer-nav .btn {
  min-width: 6.5rem;
  max-width: 14rem;
  flex: 1;
  font-weight: 500;
  font-size: 0.92rem;
  min-height: 2.5rem;
  padding: 0.55rem 1rem;
}

@media (min-width: 720px) {
  .footer-nav {
    left: 50%;
    width: 720px;
    margin-left: -360px;
    border-radius: 12px 12px 0 0;
  }
}

/* buttons */
.btn {
  font: inherit;
  font-weight: 600;
  border-radius: 10px;
  border: none;
  padding: 0.75rem 1.15rem;
  cursor: pointer;
  min-height: 2.85rem;
  transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease,
    opacity 0.2s ease, transform 0.15s ease, box-shadow 0.25s ease;
}

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

.btn.primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 10px rgba(43, 123, 185, 0.22);
}

.btn.primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn.primary:active:not(:disabled) {
  transform: scale(0.98);
}

.btn.secondary {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border-solid);
  box-shadow: none;
}

.btn.secondary:hover:not(:disabled) {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: rgba(43, 123, 185, 0.35);
}

.btn.ghost {
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px dashed var(--primary);
  width: 100%;
  margin-top: 0.25rem;
}

.btn.ghost:hover {
  background: #d6ebf7;
}

.row-btns .btn.ghost {
  width: auto;
  flex: 1;
}
