:root {
  --navy: #1f4e79;
  --navy-deep: #143352;
  --gold: #c9a05c;
  --gold-deep: #a87f3d;
  --text: #2a2f36;
  --text-light: #8a919b;
  --error: #d9432f;
  --success: #1f9d61;
  --radius: 16px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--navy-deep);
}

.page {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

/* 海报背景固定铺满视口（不随内容拉伸，避免文字错位） */
.page::before {
  content: "";
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100vw, 480px);
  height: 100vh;
  height: 100dvh;
  background: #143352 url(../assets/bg.jpg) no-repeat top center / cover;
  z-index: -1;
}

/* ---------- 报名视图 ---------- */

/* 顶部留给海报文字（品牌区/主标题/副标题），小屏适当压缩、大屏多留白 */
.register-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: clamp(280px, 47vh, 460px) 20px calc(28px + env(safe-area-inset-bottom));
}

.card {
  width: 100%;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 12px 36px rgba(5, 25, 50, 0.28);
  padding: 26px 22px 30px;
}

/* 大屏（平板/横屏）：限制卡片宽度居中，避免输入框过宽 */
@media (min-width: 600px) {
  .register-view {
    padding-left: 32px;
    padding-right: 32px;
  }

  .card {
    max-width: 460px;
    margin: 0 auto;
  }
}

.card-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
}

.card-desc {
  margin: 6px 0 22px;
  font-size: 13px;
  color: var(--text-light);
}

.field {
  margin-bottom: 14px;
}

.input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  font-size: 16px;
  color: var(--text);
  background: #f5f7fa;
  border: 1px solid transparent;
  border-radius: 10px;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.input::placeholder {
  color: #7a8490;
}

.input:focus {
  border-color: var(--gold);
  background: #fff;
}

.input.invalid {
  border-color: var(--error);
  background: #fef5f4;
}

.submit-btn {
  position: relative;
  width: 100%;
  height: 48px;
  margin-top: 6px;
  border: none;
  border-radius: 24px;
  background: #0B2B8E;
  box-shadow: 0 8px 20px rgba(11, 43, 142, 0.4);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 4px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}

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

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

.submit-btn .spinner {
  display: none;
  width: 18px;
  height: 18px;
  margin-right: 8px;
  vertical-align: -3px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.submit-btn.loading .spinner {
  display: inline-block;
}

.submit-btn.loading {
  letter-spacing: 1px;
}

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

/* ---------- 成功视图 ---------- */

/* 与报名卡片同一起始位置（海报文字下方） */
.success-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(280px, 47vh, 460px) 24px calc(40px + env(safe-area-inset-bottom));
}

.success-card {
  width: 100%;
  max-width: 340px;
  background: rgba(255, 255, 255, 0.96);
  border-radius: var(--radius);
  box-shadow: 0 12px 36px rgba(5, 25, 50, 0.28);
  padding: 44px 28px 40px;
  text-align: center;
  animation: rise 0.45s ease-out;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.check-wrap {
  width: 76px;
  height: 76px;
  margin: 0 auto 22px;
}

.check-svg {
  width: 100%;
  height: 100%;
}

.check-circle {
  stroke: var(--success);
  stroke-dasharray: 183;
  stroke-dashoffset: 183;
  animation: draw 0.55s ease-out 0.1s forwards;
}

.check-mark {
  stroke: var(--success);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: draw 0.35s ease-out 0.55s forwards;
}

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

.success-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}

.success-desc {
  margin-top: 14px;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-light);
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  top: 0;
  left: 50%;
  z-index: 999;
  max-width: 86vw;
  padding: 12px 20px;
  border-radius: 0 0 12px 12px;
  background: rgba(20, 33, 47, 0.92);
  color: #fff;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
  transform: translate(-50%, -110%);
  transition: transform 0.3s ease;
}

.toast.show {
  transform: translate(-50%, 0);
}

.toast.success {
  background: rgba(23, 122, 82, 0.95);
}

.toast.error {
  background: rgba(190, 54, 38, 0.95);
}
