/* 设计稿 856@2x → 逻辑宽 428，对齐 zxcoupon / payh5：画板居中 + 切图铺底 */
html {
  font-size: calc(100vw / 4.28);
}
@media (min-width: 428px) {
  html { font-size: 100px; }
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  min-height: 100%;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

body {
  display: flex;
  justify-content: center;
  background: #f5f5f5;
}

.page {
  position: relative;
  width: 100%;
  max-width: 428px;
  min-height: 100vh;
  overflow-x: hidden;
  padding-bottom: calc(0.24rem + env(safe-area-inset-bottom, 0px));
}

.nav {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: calc(0.44rem + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 0.1rem 0 0.16rem;
  background: #fff;
}

.nav-title {
  font-size: 0.16rem;
  font-weight: 500;
  color: #333;
  line-height: 0.44rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-close {
  flex-shrink: 0;
  width: 0.44rem;
  height: 0.44rem;
  border: 0;
  background: transparent;
  color: #888;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-close:active {
  opacity: 0.55;
}

.page-activate {
  background-color: #ff823f;
  background-image: url("../assets/bg-activate-hd.png");
  background-repeat: no-repeat;
  background-size: 100% 100%;
  background-position: center top;
}

.page-success {
  background-color: #ff8a28;
  background-image: url("../assets/bg-success-hd.png");
  background-repeat: no-repeat;
  background-size: 100% 100%;
  background-position: center top;
}

.hero {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 2.42rem;
  overflow: hidden;
  pointer-events: none;
}

.hero-success {
  height: 2.72rem;
}

.hero-img {
  display: none;
}

.skin {
  position: relative;
  z-index: 10;
  width: 4.16rem;
  margin-left: auto;
  margin-right: auto;
}

.skin-download,
.skin-teacher {
  width: 3.74rem;
}

.skin-img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
  user-select: none;
}

/* 短信卡相对顶部主视觉的间距：负数越大越往上贴，越小间距越大 */
.skin-sms {
  margin-top: -1.05rem;
}

.skin-phone {
  margin-top: 0.001rem;
}

.skin-download {
  margin-top: -0.44rem;
}

.skin-teacher {
  margin-top: 0.02rem;
}

.layer {
  position: absolute;
  left: 0;
  right: 0;
}

.sms-box {
  position: relative;
  flex-shrink: 0;
}

.layer-phone {
  top: 34%;
  bottom: 16%;
  padding: 0 0.26rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.layer-sms {
  top: 19%;
  bottom: 5%;
  padding: 0 0.18rem;
  flex-direction: column;
  overflow: hidden;
  z-index: 2;
}

textarea,
input {
  font-family: inherit;
  user-select: text;
  -webkit-user-select: text;
}

.sms-box textarea {
  display: block;
  width: 100%;
  height: 1.1rem;
  border: 1.5px solid #E8E4DC;
  border-radius: 0.2rem;
  background: #fff;
  padding: 0.1rem 0.4rem 0.44rem 0.16rem;
  font-size: 0.15rem;
  line-height: 0.18rem;
  color: #333;
  outline: none;
  resize: none;
  overflow: hidden;
}
.sms-box textarea::placeholder { color: #999; }
.sms-box textarea:focus {
  border: 3px solid #FFE154;
}

.btn-clear {
  -webkit-appearance: none;
  appearance: none;
  position: absolute;
  top: 0.1rem;
  right: 0.12rem;
  width: 0.22rem;
  height: 0.22rem;
  padding: 0;
  border: 0;
  background: transparent;
  display: none;
}
.btn-clear.show { display: block; }
.btn-clear img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.btn-clear:active { opacity: 0.7; }

.btn-extract {
  -webkit-appearance: none;
  appearance: none;
  position: absolute;
  right: 0.02rem;
  bottom: 0.02rem;
  width: 1.1rem;
  height: 0.36rem;
  padding: 0;
  border: 0;
  background: transparent;
}
.btn-extract img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.btn-extract:active { transform: scale(0.98); }

.code-slot {
  flex-shrink: 0;
  width: 1.96rem;
  height: 0.45rem;
  margin: 0.08rem auto;
  border-radius: 0.32rem;
  background: #f3f6f8;
  color: #999;
  font-size: 0.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.code-slot.ok,
.code-slot.err {
  width: auto;
  max-width: 100%;
  padding: 0 0.14rem;
  background: #fff;
  border: 0;
  color: #333;
}
.code-slot.ok {
  width: fit-content;        /* 绿底跟着文字收缩 */
  max-width: 100%;
  height: 0.38rem;
  padding: 0 0.16rem;
  border: 0;
  border-radius: 0.36rem;
  background: rgba(7, 221, 0, 0.2);
  color: #4fbb2b;
  font-size: 0.16rem;
  font-weight: 500;
  justify-content: center;   /* 条内文字居中 */
  margin: 0.12rem auto 0.2rem;
/*        上     左右   下  *
  margin: 0.12rem auto;      /* 上下间距，整条水平居中 */
  gap: 0.08rem;
}
.code-slot.ok .code-slot-label {
  flex-shrink: 0;
  font-size: 0.16rem;
  color: #4fbb2b;
}
.code-slot.ok b {
  margin-left: 0;
  color: #228800;
  font-size: 0.2rem;
  font-weight: 600;
  line-height: 1;
}
.code-slot.err {
  border: 0;
  color: #e24b4b;
  background: #fff5f5;
}

.sms-sample {
  position: absolute;
  left: 0.18rem;
  right: 0.18rem;
  top: 1.68rem;
  bottom: 0.04rem;
  overflow: hidden;
}
.tag {
  display: block;
  width: fit-content;
  background: #eaeef1;
  color: #666;
  font-size: 0.12rem;
  line-height: 0.18rem;
  padding: 0.03rem 0.12rem;
  border-radius: 0.18rem;
}
.sms-sample .sms-example-text {
  display: block;
  margin-top: 0.04rem;
  font-size: 0.13rem;
  line-height: 0.14rem;
  color: #7e7e7e;
}

.field {
  height: 0.5rem;
  border: 1.5px solid #E8E4DC;
  border-radius: 0.5rem;
  background: #fff;
  display: flex;
  align-items: center;
  padding: 0 0.06rem 0 0.18rem;
}
.field:focus-within {
  border: 3px solid #FFE154;
}
.prefix {
  font-size: 0.14rem;
  color: #333;
  padding-right: 0.1rem;
  margin-right: 0.1rem;
  border-right: 0.015rem solid #d9d4cc;
  line-height: 0.2rem;
}
.field input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 0.15rem;
  color: #333;
}
.field input::placeholder { color: #999; }

.btn-code {
  flex-shrink: 0;
  height: 0.4rem;
  min-width: 1.12rem;
  padding: 0 0.1rem;
  border: 0;
  border-radius: 0.4rem;
  background: #e9edf0;
  color: #999;
  font-size: 0.15rem;
}
.btn-code.ready {
  background: linear-gradient(180deg, #ff9a2e, #fc7e00);
  color: #fff;
}

.action {
  position: relative;
  z-index: 10;
  margin-top: 0.16rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.btn-activate {
  position: relative;
  width: 2.08rem;
  height: 0.54rem;
  border: 0;
  padding: 0;
  background: transparent;
  filter: drop-shadow(0 0.02rem 0.04rem rgba(168, 56, 0, 0.28));
}
.btn-activate img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.btn-activate .on { opacity: 0; }
.btn-activate.ready .off { opacity: 0; }
.btn-activate.ready .on { opacity: 1; }
.btn-activate.ready:active { transform: scale(0.98); }

.tips {
  margin-top: 0.08rem;
  text-align: center;
  font-size: 0.12rem;
  line-height: 0.2rem;
  color: #fff;
  text-shadow: 0 0.01rem 0.03rem rgba(180, 70, 0, 0.25);
}

.layer-download {
  left: 0;
  right: 0;
  bottom: 5%;
  display: flex;
  justify-content: center;
}

.btn-download {
  width: 2.32rem;
  height: 0.62rem;
  border: 0;
  padding: 0;
  background: transparent;
}
.btn-download img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.btn-download:active { transform: scale(0.98); }

.btn-save-qr {
  position: absolute;
  left: 70%;              /* 右栏中心，偏了就改 72%～78% */
  right: auto;
  bottom: 10%;            /* 离卡片底的距离，越小越靠下 */
  transform: translateX(-50%);
  border: 0;
  padding: 0;
  background: transparent;
  display: flex;
  justify-content: center;
  align-items: center;
}
/* .btn-save-qr {
  position: absolute;
  left: 52%;
  right: 6%;
  bottom: 10%;
  border: 0;
  padding: 0;
  background: transparent;
  display: flex;
  justify-content: center;
  align-items: center;
} */
.btn-save-qr img {
  display: block;
  width: 1.12rem;
  height: auto;
}
.btn-save-qr:active {
  opacity: 0.75;
}

.toast {
  position: absolute;
  left: 50%;
  top: 0.56rem;
  transform: translateX(-50%);
  z-index: 100;
  width: fit-content;
  max-width: 90%;
  min-height: 0.44rem;
  padding: 0.08rem 0.18rem 0.08rem 0.12rem;
  background: linear-gradient(272deg, #FFCBBA 1.14%, #FFE5DD 94.55%);
  border: 0;
  outline: none;
  border-radius: 999px;
  box-shadow: 0 0.04rem 0.12rem rgba(180, 90, 40, 0.16);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.08rem;
}
.toast.show { opacity: 1; }
.toast.ok {
  background: linear-gradient(272deg, #AFFF7D 1.14%, #D1FCB6 94.55%);
  box-shadow: 0 0.04rem 0.12rem rgba(80, 160, 40, 0.16);
}
.toast-icon {
  display: block;
  width: 0.24rem;
  height: 0.24rem;
  flex-shrink: 0;
  object-fit: contain;
}
.toast:not(.ok) .toast-icon-ok,
.toast.ok .toast-icon-warn {
  display: none;
}
.toast-text {
  font-size: 0.14rem;
  font-weight: 400;
  color: #7c3100;
  line-height: 1.25;
  text-align: left;
  white-space: nowrap;
}
.toast.ok .toast-text {
  color: #2a7a12;
}

.loading {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.12);
  z-index: 60;
}
.loading.show { display: flex; }
.spinner {
  width: 0.36rem;
  height: 0.36rem;
  border: 0.04rem solid rgba(255,255,255,0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 40;
  padding: 0.4rem;
}
.mask.show { display: flex; }
.dialog {
  width: 3.1rem;
  background: #fff;
  border-radius: 0.18rem;
  padding: 0.28rem 0.22rem 0.22rem;
  text-align: center;
}
.dialog-icon {
  display: block;
  width: 0.36rem;
  height: 0.32rem;
  margin: 0 auto 0.1rem;
  object-fit: contain;
}
.dialog h3 { font-size: 0.18rem; margin-bottom: 0.1rem; }
.dialog p { color: #666; font-size: 0.14rem; line-height: 0.22rem; margin-bottom: 0.18rem; }
.dialog button {
  width: 100%;
  height: 0.44rem;
  border: 0;
  border-radius: 0.44rem;
  background: linear-gradient(180deg, #ff9a2e, #fc7e00);
  color: #fff;
  font-size: 0.16rem;
}

