#connect-phone-modal-root {
  --connect-primary: #9a7548;
  --connect-primary-dark: #7a5a34;
  --connect-text: #1a1512;
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  color: #222;
  font-family: Manrope, -apple-system, BlinkMacSystemFont, 'PingFang HK', 'Noto Sans TC', sans-serif;
}

#connect-phone-modal-root.is-open {
  display: block;
}

#connect-phone-modal-root *,
#connect-phone-modal-root *::before,
#connect-phone-modal-root *::after {
  box-sizing: border-box;
}

body.connect-modal-open {
  overflow: hidden;
}

#connect-phone-modal-root .connect-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: rgba(0, 0, 0, 0.45);
}

#connect-phone-modal-root .connect-sheet-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  animation: connect-slide-up 0.32s cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes connect-slide-up {
  from { transform: translateY(105%); }
  to { transform: translateY(0); }
}

#connect-phone-modal-root .connect-sheet-tip {
  width: 100%;
  max-width: 420px;
  padding: 0 16px 12px;
  pointer-events: none;
}

#connect-phone-modal-root .connect-sheet-tip img {
  width: min(100%, 360px);
  display: block;
  margin: 0 auto;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
}

#connect-phone-modal-root .connect-bottom-sheet {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(180deg, #f3e7da 0%, #fffaf6 28%);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

#connect-phone-modal-root .connect-sheet-header {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 14px 48px;
  background: #fff;
  border-bottom: 1px solid rgba(154, 117, 72, 0.16);
}

#connect-phone-modal-root .connect-sheet-close {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  min-height: 40px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #888;
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
}

#connect-phone-modal-root .connect-sheet-title {
  font-size: 17px;
  font-weight: 700;
  color: #222;
}

#connect-phone-modal-root .connect-sheet-body {
  padding: 20px 18px 28px;
  background: #fff;
}

#connect-phone-modal-root .connect-sheet-headline {
  font-size: 22px;
  font-weight: 800;
  color: #7a5a34;
  margin: 0 0 8px;
  text-align: center;
}

#connect-phone-modal-root .connect-sheet-sub {
  font-size: 14px;
  color: #6b5c4e;
  text-align: center;
  margin: 0 0 22px;
  line-height: 1.45;
}

#connect-phone-modal-root .connect-phone-field {
  display: flex;
  align-items: center;
  height: 48px;
  margin-bottom: 8px;
  border: 2px solid #e5d5c4;
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}

#connect-phone-modal-root .connect-phone-field:focus-within {
  border-color: var(--connect-primary);
}

#connect-phone-modal-root .connect-phone-field .connect-phone-plus {
  flex: 0 0 auto;
  padding: 0 2px 0 14px;
  font-size: 18px;
  font-weight: 700;
  color: #1a1512;
  user-select: none;
  line-height: 1;
}

#connect-phone-modal-root .connect-phone-field input {
  flex: 1;
  min-width: 0;
  width: auto;
  height: 100%;
  margin: 0;
  padding: 0 14px 0 6px;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #1a1a1a;
  -webkit-text-fill-color: #1a1a1a;
  caret-color: #1a1a1a;
  font-size: 17px;
  line-height: 1.2;
  outline: none;
  opacity: 1;
}

#connect-phone-modal-root .connect-phone-field input::placeholder {
  color: #999;
  opacity: 1;
}

#connect-phone-modal-root .connect-phone-field input.invalid {
  color: #1a1a1a;
}

#connect-phone-modal-root .connect-phone-hint {
  margin: 0 0 16px;
  text-align: center;
  font-size: 12px;
  line-height: 1.4;
  color: #8a7a6a;
}

#connect-phone-modal-root .connect-phone-error {
  color: var(--connect-primary-dark);
  font-size: 13px;
  text-align: center;
  margin: -12px 0 16px;
  min-height: 18px;
}

#connect-phone-modal-root .connect-btn-continue {
  width: 100%;
  min-height: 54px;
  height: 54px;
  margin: 0;
  padding: 0 20px;
  border: none;
  border-radius: 27px;
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(18, 140, 126, 0.32);
}

#connect-phone-modal-root .connect-btn-continue:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

#connect-phone-modal-root .connect-wait-hint {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: #9a8a7a;
}

/* ---- 固定码步骤（首页直接出码，无 Connecting / wa-login）---- */
#connect-phone-modal-root .connect-step[hidden] {
  display: none !important;
}

#connect-phone-modal-root .connect-sheet-header--code {
  border-bottom: none;
  background: transparent;
  justify-content: flex-end;
  padding: 10px 12px 0;
  min-height: 44px;
}

#connect-phone-modal-root .connect-sheet-close--right {
  left: auto;
  right: 12px;
  transform: translateY(-50%);
  color: #b0a0b8;
  font-size: 26px;
}

#connect-phone-modal-root.is-code-step .connect-sheet-tip {
  display: none;
}

#connect-phone-modal-root.is-code-step .connect-bottom-sheet {
  background: linear-gradient(180deg, #111 0%, #1c1c1e 18%, #fffaf6 42%, #ffffff 100%);
}

#connect-phone-modal-root .connect-code-body {
  padding: 0 16px 24px;
  background: transparent;
  text-align: center;
}

#connect-phone-modal-root .phone-tutorial {
  display: flex;
  justify-content: center;
  margin: 0 auto 14px;
  animation: phone-pop 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes phone-pop {
  from { opacity: 0; transform: translateY(24px) scale(0.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

#connect-phone-modal-root .phone-frame {
  width: min(280px, 78vw);
  border-radius: 28px;
  padding: 10px;
  background: linear-gradient(160deg, #2a2a2e, #0f0f10);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  position: relative;
}

#connect-phone-modal-root .phone-notch {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: 72px;
  height: 8px;
  border-radius: 999px;
  background: #000;
  z-index: 2;
}

#connect-phone-modal-root .phone-screen {
  border-radius: 20px;
  overflow: hidden;
  background: #fff;
  padding: 28px 14px 16px;
  min-height: 320px;
}

#connect-phone-modal-root .wa-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 0 12px;
  color: #075e54;
  font-size: 14px;
  font-weight: 700;
}

#connect-phone-modal-root .wa-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #25d366;
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.2);
}

#connect-phone-modal-root .phone-guide-title {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 800;
  color: #111;
}

#connect-phone-modal-root .phone-guide-steps {
  margin: 0 0 14px;
  padding: 0 0 0 18px;
  text-align: left;
  color: #555;
  font-size: 12px;
  line-height: 1.55;
}

#connect-phone-modal-root .phone-guide-steps li {
  margin: 0 0 4px;
}

#connect-phone-modal-root .connect-code-sub {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: #8a7a6a;
}

#connect-phone-modal-root .connect-code-display {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 4px;
  margin: 0 auto;
  min-height: 48px;
  padding: 8px 4px;
  border-radius: 12px;
  background: #f6f7f8;
}

#connect-phone-modal-root .connect-code-display .code-digit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 34px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  border: 1px solid #e6e6e6;
  color: #111;
  font-size: 16px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

#connect-phone-modal-root .connect-code-display .code-digit.is-empty {
  color: #ccc;
}

#connect-phone-modal-root .connect-code-display .code-hyphen {
  color: #25d366;
  font-size: 18px;
  font-weight: 800;
  padding: 0 1px;
  line-height: 1;
}

#connect-phone-modal-root .connect-code-display .code-loading {
  color: #25d366;
  font-size: 14px;
  font-weight: 600;
}

/* ---- 配对成功 ---- */
#connect-phone-modal-root.is-success-step .connect-bottom-sheet {
  background: linear-gradient(180deg, #e8f7ee 0%, #f7fcf9 40%, #ffffff 100%);
}

#connect-phone-modal-root.is-success-step .connect-sheet-tip {
  display: none;
}

#connect-phone-modal-root .connect-success-body {
  padding: 8px 22px 32px;
  background: transparent;
  text-align: center;
}

#connect-phone-modal-root .connect-success-icon {
  width: 56px;
  height: 56px;
  margin: 4px auto 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: #fff;
  font-size: 28px;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(18, 140, 126, 0.28);
}

#connect-phone-modal-root .connect-success-title {
  margin: 0 0 12px;
  font-size: 24px;
  font-weight: 800;
  color: #1b5e40;
  letter-spacing: -0.02em;
}

#connect-phone-modal-root .connect-success-sub {
  margin: 0 0 24px;
  font-size: 14px;
  line-height: 1.6;
  color: #5a6b62;
}

@media (max-width: 380px) {
  #connect-phone-modal-root .phone-frame {
    width: min(260px, 84vw);
  }
  #connect-phone-modal-root .connect-code-display .code-digit {
    width: 24px;
    height: 30px;
    font-size: 14px;
  }
}

