/* ============ 弹层：预约弹窗 / 请求遮罩 / Toast / 返回顶部 ============ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal.open {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 75, 183, 0.22), transparent 20rem),
    radial-gradient(circle at 62% 58%, rgba(63, 231, 255, 0.2), transparent 28rem),
    rgba(5, 6, 13, 0.82);
  backdrop-filter: blur(10px);
}

.modal.open .modal-backdrop {
  animation: fadeIn 0.3s ease both;
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  padding: clamp(24px, 4vw, 36px);
  border: 2px solid rgba(63, 231, 255, 0.82);
  border-radius: 0;
  background:
    linear-gradient(135deg, rgba(182, 255, 61, 0.1), transparent 22%),
    linear-gradient(155deg, rgba(31, 43, 227, 0.36), rgba(5, 6, 13, 0.96)),
    var(--panel-strong);
  box-shadow:
    8px 9px 0 rgba(255, 75, 183, 0.76),
    -7px -6px 0 rgba(182, 255, 61, 0.68),
    0 0 70px rgba(63, 231, 255, 0.28);
  clip-path: polygon(28px 0, 100% 0, 100% calc(100% - 30px), calc(100% - 30px) 100%, 0 100%, 0 28px);
  overflow: hidden;
}

.modal.open .modal-panel {
  animation: modalIn 0.55s cubic-bezier(0.18, 1.25, 0.4, 1) both;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(38px) scale(0.92) rotate(-1.2deg);
  }
}

.modal-panel::before,
.modal-panel::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.modal-panel::before {
  inset: 0;
  background:
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.07) 0 1px, transparent 1px 8px),
    linear-gradient(90deg, transparent, rgba(63, 231, 255, 0.14), transparent);
  opacity: 0.2;
}

.modal-panel::after {
  right: -44px;
  bottom: 28px;
  width: 170px;
  height: 36px;
  background: var(--lime);
  transform: rotate(-12deg);
  box-shadow: 0 0 28px rgba(182, 255, 61, 0.45);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  background: rgba(5, 6, 13, 0.72);
  color: var(--white);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  clip-path: polygon(9px 0, 100% 0, calc(100% - 9px) 100%, 0 100%);
  transition: color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.modal-close:hover {
  border-color: var(--magenta);
  color: var(--magenta);
  transform: translateY(-2px) rotate(90deg);
}

.modal-form,
.success-panel {
  position: relative;
  z-index: 1;
}

.modal-panel h2 {
  margin: 10px 0 12px;
  font-size: clamp(38px, 6vw, 58px);
}

.modal-kicker,
.modal-signal {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.modal-kicker span,
.modal-signal span {
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--cyan);
  font-family: "Saira Condensed", "Noto Sans SC", sans-serif;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  clip-path: polygon(9px 0, 100% 0, calc(100% - 9px) 100%, 0 100%);
}

.modal-kicker span {
  padding: 5px 12px;
  background: rgba(255, 75, 183, 0.12);
}

.modal-kicker span:last-child {
  color: #09100a;
  background: var(--lime);
  border-color: var(--lime);
}

.modal-signal {
  margin: 16px 0 18px;
}

.modal-signal span {
  flex: 1;
  min-width: 104px;
  padding: 8px 10px;
  text-align: center;
  color: var(--white);
  background: rgba(255, 255, 255, 0.055);
}

.modal-sub {
  color: var(--muted);
  line-height: 1.6;
}

.modal-sub strong {
  color: var(--lime);
}

.form-field {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.form-field label {
  color: var(--lime);
  font-family: "Saira Condensed", "Noto Sans SC", sans-serif;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

#register-form input[type="tel"],
#register-form input[type="text"] {
  width: 100%;
  height: 54px;
  border: 2px solid rgba(63, 231, 255, 0.32);
  border-radius: 0;
  outline: 0;
  padding: 0 16px;
  color: var(--white);
  background:
    linear-gradient(90deg, rgba(63, 231, 255, 0.12), transparent 38%),
    rgba(255, 255, 255, 0.06);
  clip-path: polygon(13px 0, 100% 0, calc(100% - 13px) 100%, 0 100%);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

#register-form input:focus {
  border-color: var(--lime);
  box-shadow: 0 0 24px rgba(182, 255, 61, 0.2);
  background:
    linear-gradient(90deg, rgba(182, 255, 61, 0.15), transparent 42%),
    rgba(255, 255, 255, 0.08);
}

.code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 122px;
  gap: 8px;
}

#get-code {
  border: 2px solid rgba(63, 231, 255, 0.46);
  border-radius: 0;
  background: rgba(5, 6, 13, 0.72);
  color: var(--cyan);
  cursor: pointer;
  font-weight: 900;
  padding: 0 12px;
  white-space: nowrap;
  clip-path: polygon(13px 0, 100% 0, calc(100% - 13px) 100%, 0 100%);
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

#get-code:hover:not(:disabled) {
  border-color: var(--lime);
  color: var(--lime);
  background: rgba(182, 255, 61, 0.1);
}

#get-code:disabled {
  cursor: not-allowed;
  color: rgba(255, 255, 255, 0.56);
  border-color: rgba(255, 255, 255, 0.16);
}

.agree-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  cursor: pointer;
}

.agree-row > div {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
}

.agree-row label {
  cursor: pointer;
}

.agree-row input {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  margin-top: 1px;
  accent-color: var(--lime);
}

.policy-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--cyan);
  cursor: pointer;
  font: inherit;
  line-height: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.policy-link:hover,
.policy-link:focus-visible {
  color: var(--lime);
}

/* 协议阅读弹窗 */
.policy-modal {
  z-index: 340;
}

.policy-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(880px, 100%);
  height: min(82svh, 780px);
  max-height: calc(100svh - 48px);
  padding: 0;
}

.policy-panel::after {
  display: none;
}

.policy-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 96px;
  padding: 20px 78px 18px 30px;
  border-bottom: 1px solid rgba(63, 231, 255, 0.26);
  background: rgba(5, 6, 13, 0.7);
}

.policy-kicker {
  color: var(--lime);
  font-family: "Saira Condensed", "Noto Sans SC", sans-serif;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.policy-panel .policy-title {
  margin: 4px 0 0;
  font-size: clamp(25px, 4vw, 38px);
  line-height: 1.1;
}

.policy-close {
  top: 22px;
  right: 24px;
}

.policy-scroll {
  position: relative;
  z-index: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 28px 34px 40px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.85;
  scrollbar-color: var(--cyan) rgba(255, 255, 255, 0.08);
  scrollbar-width: thin;
}

.policy-scroll::-webkit-scrollbar {
  width: 8px;
}

.policy-scroll::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.06);
}

.policy-scroll::-webkit-scrollbar-thumb {
  background: var(--cyan);
}

.policy-scroll h3 {
  margin: 26px 0 8px;
  color: var(--white);
  font-size: 18px;
  line-height: 1.45;
}

.policy-scroll p + p {
  margin-top: 12px;
}

.policy-scroll strong {
  color: var(--lime);
}

.policy-update {
  margin-bottom: 20px;
  color: var(--cyan);
  font-size: 13px;
}

@media (max-width: 600px) {
  .policy-modal {
    padding: 10px;
  }

  .policy-panel {
    height: calc(100svh - 20px);
    max-height: calc(100svh - 20px);
    box-shadow:
      4px 5px 0 rgba(255, 75, 183, 0.68),
      -3px -3px 0 rgba(182, 255, 61, 0.56),
      0 0 38px rgba(63, 231, 255, 0.24);
    clip-path: polygon(18px 0, 100% 0, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0 100%, 0 18px);
  }

  .policy-header {
    min-height: 80px;
    padding: 15px 62px 14px 20px;
  }

  .policy-panel .policy-title {
    font-size: 27px;
  }

  .policy-close {
    top: 15px;
    right: 15px;
  }

  .policy-scroll {
    padding: 20px 20px calc(30px + env(safe-area-inset-bottom));
    font-size: 14px;
    line-height: 1.75;
  }

  .policy-scroll h3 {
    margin-top: 22px;
    font-size: 16px;
  }
}

.form-error {
  min-height: 20px;
  margin-top: 10px;
  color: var(--magenta);
  font-size: 13px;
  font-weight: 700;
}

.modal .submit-btn {
  width: 100%;
  margin-top: 14px;
  padding: 16px;
  border: 2px solid rgba(5, 6, 13, 0.92);
  border-radius: 0;
  background: linear-gradient(105deg, var(--lime), #f6ff5b 54%, var(--cyan));
  color: #071006;
  font-family: "Saira Condensed", "Noto Sans SC", sans-serif;
  font-size: 24px;
  letter-spacing: 0.06em;
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.32);
  box-shadow:
    4px 5px 0 rgba(255, 75, 183, 0.86),
    0 0 26px rgba(182, 255, 61, 0.34);
  clip-path: polygon(18px 0, 100% 0, calc(100% - 18px) 100%, 0 100%);
}

.success-panel {
  text-align: center;
}

.success-mark {
  width: 70px;
  height: 70px;
  margin: 6px auto 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--lime), var(--cyan));
  box-shadow: 0 0 32px rgba(182, 255, 61, 0.38);
  animation: successPop 0.6s var(--ease-spring) both;
}

@keyframes successPop {
  from { transform: scale(0); }
}

.success-mark::after {
  content: "";
  display: block;
  width: 30px;
  height: 16px;
  border-left: 5px solid #071006;
  border-bottom: 5px solid #071006;
  transform: translate(20px, 22px) rotate(-45deg);
}

.success-panel p {
  color: var(--muted);
  line-height: 1.7;
}

.success-qq-invite {
  position: relative;
  display: grid;
  gap: 5px;
  margin-top: 20px;
  padding: 16px 18px;
  border: 2px solid var(--cyan);
  color: var(--white);
  background:
    linear-gradient(105deg, rgba(255, 75, 183, 0.2), transparent 34%),
    rgba(5, 8, 18, 0.78);
  box-shadow:
    4px 5px 0 rgba(255, 75, 183, 0.78),
    0 0 24px rgba(63, 231, 255, 0.2);
  clip-path: polygon(14px 0, 100% 0, calc(100% - 14px) 100%, 0 100%);
  transition: transform 0.18s ease, filter 0.18s ease;
}

.success-qq-invite:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.success-qq-kicker {
  color: var(--cyan);
  font-size: 13px;
  font-weight: 700;
}

.success-qq-invite strong {
  color: var(--white);
  font-family: "Saira Condensed", "Noto Sans SC", sans-serif;
  font-size: clamp(25px, 6vw, 34px);
  font-weight: 900;
  line-height: 1.15;
}

.success-qq-action {
  color: var(--lime);
  font-size: 14px;
  font-weight: 900;
}

@media (max-width: 600px), (max-height: 680px) {
  .modal {
    align-items: flex-start;
    overflow-y: auto;
  }

  .modal-panel {
    margin: auto 0;
  }

  .success-qq-invite {
    margin-top: 14px;
    padding: 12px 14px;
  }
}

.back-top {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 110;
  display: none;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(5, 6, 13, 0.8);
  color: var(--cyan);
  cursor: pointer;
  font-size: 22px;
  backdrop-filter: blur(8px);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.back-top:hover {
  border-color: var(--cyan);
  box-shadow: 0 0 18px rgba(63, 231, 255, 0.45);
  transform: translateY(-3px);
}

.back-top.show {
  display: block;
  animation: fadeIn 0.3s ease;
}

.request-mask {
  position: fixed;
  inset: 0;
  z-index: 380;
  display: none;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 48%, rgba(63, 231, 255, 0.22), transparent 22rem),
    rgba(5, 6, 13, 0.58);
  backdrop-filter: blur(6px);
}

.request-mask.show {
  display: grid;
}

.request-card {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
  padding: 16px 20px;
  border: 1px solid rgba(63, 231, 255, 0.5);
  background:
    linear-gradient(135deg, rgba(182, 255, 61, 0.12), rgba(63, 231, 255, 0.1)),
    rgba(5, 6, 13, 0.92);
  color: var(--white);
  font-weight: 900;
  box-shadow:
    5px 6px 0 rgba(255, 75, 183, 0.64),
    0 0 36px rgba(63, 231, 255, 0.26);
  clip-path: polygon(14px 0, 100% 0, calc(100% - 14px) 100%, 0 100%);
}

.request-spinner {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(255, 255, 255, 0.24);
  border-top-color: var(--lime);
  border-radius: 50%;
  animation: spin 0.78s linear infinite;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 400;
  min-width: 220px;
  max-width: calc(100% - 36px);
  padding: 12px 18px;
  border: 1px solid rgba(63, 231, 255, 0.5);
  background:
    linear-gradient(90deg, rgba(63, 231, 255, 0.12), rgba(255, 75, 183, 0.08)),
    rgba(5, 6, 13, 0.92);
  color: var(--white);
  font-weight: 700;
  text-align: center;
  clip-path: polygon(12px 0, 100% 0, calc(100% - 12px) 100%, 0 100%);
  box-shadow: 4px 5px 0 rgba(255, 75, 183, 0.5);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity 0.25s ease, transform 0.25s var(--ease-spring);
}

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