:root {
  --blue: #1f72ff;
  --blue-dark: #1b63de;
  --bg: #f4f6fb;
  --text: #222;
  --muted: #8a8f99;
  --card: #ffffff;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
}

body {
  min-height: 100vh;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--blue);
  color: #fff;
  padding: 16px 16px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.back-btn {
  width: 32px;
  height: 32px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.back-btn svg {
  fill: #fff;
}

.topbar-title {
  flex: 1;
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 1px;
}

.page {
  flex: 1;
  padding: 18px 16px 24px;
  display: none;
}

.page.active {
  display: block;
}

.hero {
  background: var(--blue);
  color: #fff;
  padding: 22px 16px 28px;
  border-radius: 0 0 28px 28px;
  text-align: center;
  position: relative;
}

.hero .badge {
  width: 48px;
  height: 48px;
  margin: 4px auto 10px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--blue);
  font-size: 20px;
}

.hero .subtitle {
  font-size: 14px;
  opacity: 0.85;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.card + .card {
  margin-top: 14px;
}

.pay-card {
  margin-top: -28px;
}

.price {
  font-size: 36px;
  font-weight: 700;
  margin: 8px 0 14px;
}

.btn-primary {
  width: 100%;
  height: 44px;
  border: none;
  border-radius: 10px;
  background: var(--blue);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary:disabled {
  background: #aac6ff;
  cursor: not-allowed;
}

.agree-row {
  margin-top: 12px;
  display: flex;
  align-items: center;
  font-size: 14px;
  color: #444;
  gap: 8px;
}

.checkbox {
  width: 18px;
  height: 18px;
  border: 1px solid #c8cdd6;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: #fff;
}

.checkbox.checked {
  border-color: var(--blue);
  background: var(--blue);
}

.checkbox.checked::after {
  content: '';
  width: 6px;
  height: 10px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
  margin-top: -2px;
}

.link {
  color: var(--blue);
  cursor: pointer;
}

.section-title {
  color: #9aa0a6;
  font-size: 13px;
  margin: 18px 4px 8px;
}

.row {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  padding: 8px 0;
  border-bottom: 1px solid #f0f2f6;
}

.row:last-child {
  border-bottom: none;
}

.row .k {
  color: #666;
}

.row .v {
  color: #222;
  font-weight: 500;
}

.row .status {
  color: #2ea44f;
  font-weight: 600;
}

.footer-btn {
  margin: 24px 0 10px;
}

.agreement-wrap {
  background: #f0f3fb;
  min-height: calc(100vh - 60px);
  padding-bottom: 24px;
}

.agreement-card {
  background: #fff;
  border-radius: 22px;
  padding: 24px 20px;
  box-shadow: var(--shadow);
}

.agreement-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 10px;
}

.agreement-subtitle {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 18px;
}

.agreement-text {
  font-size: 15px;
  line-height: 1.8;
  color: #333;
  white-space: pre-wrap;
}

.sign-btn {
  margin-top: 18px;
}

.signature-wrap {
  background: #000;
  min-height: calc(100vh - 60px);
  padding: 16px;
  color: #fff;
}

.signature-panel {
  background: #fff;
  border-radius: 8px;
  padding: 10px;
  color: #333;
  position: relative;
}

.signature-tip {
  text-align: center;
  font-size: 14px;
  padding: 8px 0;
  color: #666;
}

.signature-canvas-box {
  position: relative;
  border: 2px dashed #e0e0e0;
  border-radius: 6px;
  height: 360px;
  overflow: hidden;
}

.signature-canvas-box::after {
  content: '签\A字\A范\A围';
  white-space: pre;
  color: rgba(0, 0, 0, 0.08);
  font-size: 48px;
  font-weight: 700;
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
}

.signature-right-tip {
  position: absolute;
  right: -16px;
  top: 50%;
  transform: translate(100%, -50%) rotate(90deg);
  font-size: 13px;
  color: #666;
  white-space: nowrap;
}

.signature-actions {
  margin-top: 14px;
  display: flex;
  gap: 12px;
}

.signature-actions button {
  flex: 1;
  height: 44px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid var(--blue);
  background: #fff;
  color: var(--blue);
}

.signature-actions .save {
  background: var(--blue);
  color: #fff;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 80px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
}

@media (min-width: 768px) {
  body {
    max-width: 420px;
    margin: 0 auto;
    border-left: 1px solid #e6e8ef;
    border-right: 1px solid #e6e8ef;
  }
}
