/* ==========================================================================
   星轨云 NebulaCloud · 通用样式
   ========================================================================== */

:root {
  --bg: #070b16;
  --bg-soft: #0c1224;
  --panel: rgba(18, 26, 48, 0.72);
  --panel-solid: #101830;
  --line: rgba(122, 152, 220, 0.16);
  --line-strong: rgba(122, 152, 220, 0.32);
  --text: #e9eeff;
  --text-dim: #b3c0e0;
  --muted: #7d8cb4;
  --brand: #22d3ee;
  --brand-2: #7c5cff;
  --brand-3: #2ee6a8;
  --danger: #ff5c7a;
  --warn: #ffb020;
  --ok: #2ee6a8;
  --radius-lg: 22px;
  --radius: 12px;
  --radius-sm: 9px;
  --shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  --font: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Segoe UI",
    system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

a {
  color: var(--brand);
  text-decoration: none;
  transition: color 0.18s ease;
}

a:hover {
  color: #6fe6ff;
}

/* ---------- 背景光斑 ---------- */
.bg-blobs {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.bg-blobs::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(122, 152, 220, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(122, 152, 220, 0.045) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 40%, #000 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 40%, #000 30%, transparent 100%);
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
  animation: drift 22s ease-in-out infinite;
}

.blob.b1 {
  width: 460px;
  height: 460px;
  top: -140px;
  left: -110px;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.55), transparent 68%);
}

.blob.b2 {
  width: 520px;
  height: 520px;
  bottom: -190px;
  right: -140px;
  background: radial-gradient(circle, rgba(124, 92, 255, 0.55), transparent 68%);
  animation-delay: -7s;
}

.blob.b3 {
  width: 340px;
  height: 340px;
  top: 45%;
  left: 46%;
  background: radial-gradient(circle, rgba(46, 230, 168, 0.28), transparent 68%);
  animation-delay: -13s;
}

@keyframes drift {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(30px, -34px, 0) scale(1.09);
  }
}

/* ---------- 布局 ---------- */
.auth-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
}

/* 左侧品牌区 */
.brand-panel {
  position: relative;
  padding: 56px 60px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(16, 24, 46, 0.7), rgba(8, 12, 24, 0.35));
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--text);
}

.logo .mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 10px 26px -10px rgba(34, 211, 238, 0.75);
}

.logo .mark svg {
  width: 22px;
  height: 22px;
}

.logo small {
  display: block;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 2.6px;
  color: var(--muted);
  text-transform: uppercase;
}

.brand-hero h2 {
  margin: 0 0 16px;
  font-size: clamp(28px, 2.5vw, 40px);
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.brand-hero h2 em {
  font-style: normal;
  background: linear-gradient(100deg, var(--brand), var(--brand-2) 55%, var(--brand-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-hero p {
  margin: 0;
  max-width: 44ch;
  color: var(--text-dim);
  font-size: 15px;
}

.feature-list {
  list-style: none;
  margin: 34px 0 0;
  padding: 0;
  display: grid;
  gap: 14px;
}

.feature-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--text-dim);
}

.feature-list .dot {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(34, 211, 238, 0.1);
  border: 1px solid rgba(34, 211, 238, 0.22);
  color: var(--brand);
}

.feature-list .dot svg {
  width: 15px;
  height: 15px;
}

.brand-foot {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
  padding-top: 28px;
  font-size: 12.5px;
  color: var(--muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(46, 230, 168, 0.28);
  background: rgba(46, 230, 168, 0.08);
  color: var(--ok);
  font-size: 12px;
}

.status-pill i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(46, 230, 168, 0.6);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(46, 230, 168, 0.55);
  }
  70% {
    box-shadow: 0 0 0 9px rgba(46, 230, 168, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(46, 230, 168, 0);
  }
}

/* 右侧表单区 */
.form-panel {
  display: grid;
  place-items: center;
  padding: 48px 32px;
}

.card {
  width: 100%;
  max-width: 430px;
  padding: 38px 36px 32px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  animation: rise 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

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

.card-head {
  margin-bottom: 26px;
}

.card-head h1 {
  margin: 0 0 8px;
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.card-head p {
  margin: 0;
  font-size: 13.5px;
  color: var(--muted);
}

/* ---------- 表单控件 ---------- */
.field {
  margin-bottom: 17px;
}

.field label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
}

.field label .hint {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
}

.control {
  position: relative;
  display: flex;
  align-items: center;
}

.control > .icon {
  position: absolute;
  left: 13px;
  display: grid;
  place-items: center;
  color: var(--muted);
  pointer-events: none;
  transition: color 0.18s ease;
}

.control > .icon svg {
  width: 16px;
  height: 16px;
}

input[type="text"],
input[type="password"],
input[type="email"] {
  width: 100%;
  height: 46px;
  padding: 0 14px 0 40px;
  font-family: inherit;
  font-size: 14.5px;
  color: var(--text);
  background: rgba(9, 14, 28, 0.85);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

input::placeholder {
  color: #5d6b90;
}

input[type="text"]:focus,
input[type="password"]:focus {
  border-color: rgba(34, 211, 238, 0.72);
  background: rgba(9, 16, 34, 0.95);
  box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.12);
}

.control:focus-within > .icon {
  color: var(--brand);
}

.field.has-error input {
  border-color: rgba(255, 92, 122, 0.75);
  box-shadow: 0 0 0 4px rgba(255, 92, 122, 0.12);
}

.field.has-error .control > .icon {
  color: var(--danger);
}

.err-msg {
  display: none;
  margin-top: 6px;
  font-size: 12px;
  color: var(--danger);
}

.field.has-error .err-msg {
  display: block;
  animation: shake 0.3s ease;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-3px);
  }
  75% {
    transform: translateX(3px);
  }
}

/* 右侧小按钮（显示密码） */
.ghost-btn {
  position: absolute;
  right: 8px;
  height: 32px;
  padding: 0 9px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease;
}

.ghost-btn:hover {
  color: var(--brand);
  background: rgba(34, 211, 238, 0.1);
}

.ghost-btn svg {
  width: 17px;
  height: 17px;
}

/* 验证码行 */
.captcha-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
}

.captcha-row input {
  padding-left: 40px;
  letter-spacing: 3px;
  text-transform: none;
}

.captcha-box {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
}

#captcha-canvas {
  display: block;
  height: 46px;
  width: 124px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  cursor: pointer;
  user-select: none;
}

.captcha-refresh {
  height: 46px;
  width: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(9, 14, 28, 0.85);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.captcha-refresh:hover {
  color: var(--brand);
  border-color: rgba(34, 211, 238, 0.6);
  background: rgba(34, 211, 238, 0.1);
}

.captcha-refresh.spin svg {
  animation: spin 0.5s ease;
}

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

.captcha-refresh svg {
  width: 17px;
  height: 17px;
}

/* 行内：记住我 / 忘记密码 */
.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 20px;
  font-size: 13px;
}

.check {
  display: inline-flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  line-height: 1.5;
}

.check input {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 17px;
  height: 17px;
  margin: 2px 0 0;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: rgba(9, 14, 28, 0.9);
  cursor: pointer;
  position: relative;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.check input:checked {
  border-color: transparent;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}

.check input:checked::after {
  content: "";
  position: absolute;
  left: 5.5px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid #06121f;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.check a {
  color: var(--brand);
}

/* ---------- 按钮 ---------- */
.btn {
  width: 100%;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.4px;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn-primary {
  color: #04121c;
  background: linear-gradient(100deg, var(--brand), var(--brand-2));
  box-shadow: 0 16px 34px -16px rgba(34, 211, 238, 0.95);
}

.btn-primary:hover {
  filter: brightness(1.08);
  box-shadow: 0 20px 40px -16px rgba(124, 92, 255, 0.9);
}

.btn-primary:active {
  transform: translateY(1px) scale(0.995);
}

.btn-ghost {
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-strong);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.08);
}

.btn svg {
  width: 17px;
  height: 17px;
}

/* ---------- 提交加载态（注册 10 秒等待） ---------- */
.btn.is-loading {
  pointer-events: none;
  cursor: progress;
  filter: saturate(0.8) brightness(0.94);
}

.btn:disabled {
  cursor: not-allowed;
}

.btn .spinner {
  flex: none;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 2px solid rgba(6, 18, 32, 0.25);
  border-top-color: #061220;
  animation: spin 0.7s linear infinite;
}

.submit-progress {
  display: none;
  height: 4px;
  margin-top: 12px;
  border-radius: 999px;
  background: rgba(122, 152, 220, 0.16);
  overflow: hidden;
}

.submit-progress.show {
  display: block;
}

.submit-progress i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
}

.submit-status {
  display: none;
  margin: 9px 0 0;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
  min-height: 19px;
}

.submit-status.show {
  display: block;
  animation: fade-in 0.3s ease;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* 提交中：表单整体降饱和 + 禁止交互 */
form.is-submitting .field,
form.is-submitting .row-between {
  opacity: 0.55;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

/* 分割线 */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0;
  color: var(--muted);
  font-size: 12px;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.switch-line {
  margin: 22px 0 0;
  text-align: center;
  font-size: 13.5px;
  color: var(--muted);
}

.switch-line a {
  font-weight: 600;
  margin-left: 4px;
}

.card-foot {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 11.5px;
  color: #62709a;
}

/* 密码强度 */
.strength {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.strength .bars {
  display: flex;
  gap: 4px;
  flex: 1;
}

.strength .bars span {
  height: 4px;
  flex: 1;
  border-radius: 999px;
  background: rgba(122, 152, 220, 0.18);
  transition: background 0.25s ease;
}

.strength[data-level="1"] .bars span:nth-child(1) {
  background: var(--danger);
}

.strength[data-level="2"] .bars span:nth-child(-n + 2) {
  background: var(--warn);
}

.strength[data-level="3"] .bars span:nth-child(-n + 3) {
  background: #6ea8ff;
}

.strength[data-level="4"] .bars span {
  background: var(--ok);
}

.strength .label {
  font-size: 11.5px;
  color: var(--muted);
  min-width: 46px;
  text-align: right;
}

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 7, 15, 0.66);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.modal-mask.show {
  opacity: 1;
}

.modal {
  width: 100%;
  max-width: 372px;
  padding: 30px 28px 24px;
  text-align: center;
  border-radius: 20px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, #16203a, #0e1528);
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.95);
  transform: translateY(14px) scale(0.96);
  transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}

.modal-mask.show .modal {
  transform: none;
}

.modal-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 26px;
  font-weight: 700;
  animation: pop 0.35s cubic-bezier(0.22, 1.4, 0.36, 1) both;
}

@keyframes pop {
  from {
    transform: scale(0.5);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-icon svg {
  width: 28px;
  height: 28px;
}

.modal[data-type="error"] .modal-icon {
  color: var(--danger);
  background: rgba(255, 92, 122, 0.12);
  border: 1px solid rgba(255, 92, 122, 0.35);
}

.modal[data-type="success"] .modal-icon {
  color: var(--ok);
  background: rgba(46, 230, 168, 0.12);
  border: 1px solid rgba(46, 230, 168, 0.35);
}

.modal h3 {
  margin: 0 0 9px;
  font-size: 19px;
  font-weight: 700;
}

.modal p {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-dim);
}

.modal .countdown {
  display: block;
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

.modal .modal-actions {
  margin-top: 22px;
}

.modal .modal-actions .btn {
  height: 44px;
  font-size: 14.5px;
}

/* ---------- Toast ---------- */
.toast-wrap {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  display: grid;
  gap: 10px;
  width: max-content;
  max-width: calc(100vw - 40px);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  color: var(--text);
  background: rgba(18, 26, 48, 0.96);
  border: 1px solid var(--line-strong);
  box-shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.95);
  animation: toast-in 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.toast.ok {
  border-color: rgba(46, 230, 168, 0.4);
}

.toast.err {
  border-color: rgba(255, 92, 122, 0.45);
}

.toast .tdot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
}

.toast.ok .tdot {
  background: var(--ok);
}

.toast.err .tdot {
  background: var(--danger);
}

.toast.hide {
  animation: toast-out 0.25s ease forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(-10px) scale(0.97);
  }
}

/* ---------- 响应式 ---------- */
@media (max-width: 980px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .brand-panel {
    padding: 34px 26px 26px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    gap: 22px;
  }

  .brand-hero h2 {
    font-size: 26px;
  }

  .feature-list {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin-top: 22px;
  }

  .brand-foot {
    padding-top: 4px;
  }

  .form-panel {
    padding: 30px 20px 48px;
  }
}

@media (max-width: 520px) {
  .card {
    padding: 28px 22px 24px;
    border-radius: 18px;
  }

  .captcha-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .captcha-box {
    justify-content: space-between;
  }

  #captcha-canvas {
    flex: 1;
  }
}
