/* =========================================================
   微信接入 BOT · Portal
   Login gate: authenticate, then hand the user to their BOT.
   Everything lives in this file because the page CSP is
   style-src 'self' (inline styles are not allowed).
   ========================================================= */

:root {
  color-scheme: dark;

  --bg: #070810;
  --surface: rgba(255, 255, 255, 0.035);
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);

  --fg: #ecedf5;
  --fg-dim: #b4bad0;
  --muted: #828aa8;

  --accent: #5b8cff;
  --accent-2: #8b5cf6;
  --accent-3: #22d3ee;

  --ok: #34d399;
  --err: #f87171;

  --radius: 16px;
  --radius-lg: 22px;
  --shadow: 0 26px 64px -30px rgba(0, 0, 0, 0.95);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* faint grid, fading out below the fold */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.026) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(120% 70% at 50% 0%, #000 0%, transparent 70%);
  mask-image: radial-gradient(120% 70% at 50% 0%, #000 0%, transparent 70%);
}

/* ambient colour field */
.aura {
  position: fixed;
  inset: 0;
  z-index: -3;
  overflow: hidden;
  pointer-events: none;
}

.aura span {
  position: absolute;
  display: block;
  border-radius: 50%;
  filter: blur(90px);
}

.aura span:nth-child(1) {
  width: 44vw;
  height: 44vw;
  top: -14vw;
  left: -8vw;
  background: radial-gradient(circle, #3452ff 0%, transparent 68%);
  opacity: 0.55;
}

.aura span:nth-child(2) {
  width: 38vw;
  height: 38vw;
  top: -6vw;
  right: -10vw;
  background: radial-gradient(circle, #7c3aed 0%, transparent 68%);
  opacity: 0.45;
}

.aura span:nth-child(3) {
  width: 52vw;
  height: 52vw;
  bottom: -34vw;
  left: 24vw;
  background: radial-gradient(circle, #06b6d4 0%, transparent 70%);
  opacity: 0.22;
}

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px clamp(16px, 4vw, 44px);
  border-bottom: 1px solid var(--line);
  background: rgba(7, 8, 16, 0.72);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 26px -10px rgba(91, 140, 255, 0.95);
}

.brand-mark svg {
  width: 21px;
  height: 21px;
}

.brand-text {
  display: grid;
  line-height: 1.25;
}

.brand-text strong {
  font-size: 0.96rem;
  font-weight: 620;
  letter-spacing: 0.01em;
}

.brand-text em {
  font-style: normal;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.topbar-meta {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}

.dot-live {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.14);
  animation: pulse 2.6s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.4;
    transform: scale(0.82);
  }
}

/* ---------- layout ---------- */

.shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: clamp(28px, 5vw, 60px) clamp(16px, 4vw, 44px) 72px;
  display: grid;
  gap: 24px;
}

.view {
  display: grid;
  gap: 20px;
}

/* ---------- auth screen ---------- */

.auth-screen {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: clamp(28px, 5vw, 64px);
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 0.7rem;
  font-weight: 560;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #a9b6de;
}

.eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-3);
  box-shadow: 0 0 10px var(--accent-3);
}

h1 {
  margin: 0 0 18px;
  font-size: clamp(1.85rem, 3.6vw, 2.7rem);
  font-weight: 680;
  line-height: 1.14;
  letter-spacing: -0.028em;
  text-wrap: balance;
}

.grad {
  background: linear-gradient(100deg, var(--accent-3) 0%, var(--accent) 45%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.lead {
  margin: 0 0 30px;
  max-width: 46ch;
  font-size: 0.98rem;
  color: var(--fg-dim);
}

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

.feature-list li {
  display: flex;
  gap: 13px;
  align-items: flex-start;
}

.fi {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--accent-3);
}

.fi svg {
  width: 16px;
  height: 16px;
}

.feature-list b {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fg);
}

.feature-list small {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
}

/* ---------- auth panel ---------- */

.auth-panel {
  position: relative;
  padding: clamp(22px, 3vw, 32px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.058), rgba(255, 255, 255, 0.018));
  box-shadow: var(--shadow);
  backdrop-filter: blur(26px) saturate(150%);
  -webkit-backdrop-filter: blur(26px) saturate(150%);
}

.auth-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(139, 92, 246, 0.9),
    rgba(34, 211, 238, 0.75),
    transparent
  );
}

.auth-title {
  margin: 0 0 6px;
  font-size: 1.28rem;
  font-weight: 640;
  letter-spacing: -0.018em;
}

.auth-sub {
  margin: 0 0 22px;
  font-size: 0.83rem;
  color: var(--muted);
}

.auth-switch {
  margin: 20px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
  color: var(--muted);
}

/* ---------- form ---------- */

label {
  display: block;
  margin: 15px 0 7px;
  font-size: 0.79rem;
  font-weight: 550;
  letter-spacing: 0.01em;
  color: var(--fg-dim);
}

input {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  font-size: 0.94rem;
  color: var(--fg);
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

input::placeholder {
  color: #565d7c;
}

input:focus {
  outline: none;
  background: rgba(0, 0, 0, 0.52);
  border-color: rgba(91, 140, 255, 0.85);
  box-shadow: 0 0 0 4px rgba(91, 140, 255, 0.16);
}

/* ---------- buttons ---------- */

button {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 11px 18px;
  margin: 0;
  color: #fff;
  border: 1px solid transparent;
  border-radius: 11px;
  background: linear-gradient(140deg, #5b8cff, #7c5cf6);
  box-shadow: 0 14px 30px -16px rgba(91, 140, 255, 1);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease,
    border-color 0.2s ease, color 0.2s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 20px 36px -18px rgba(91, 140, 255, 1);
}

button:active:not(:disabled) {
  transform: translateY(0);
}

button:focus-visible {
  outline: 2px solid rgba(34, 211, 238, 0.8);
  outline-offset: 2px;
}

button.secondary {
  color: var(--fg-dim);
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--line-strong);
  box-shadow: none;
}

button.secondary:hover:not(:disabled) {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: none;
}

button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
}

button.link {
  margin: 0 0 0 6px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  font-size: inherit;
  font-weight: 600;
  color: #9db8ff;
  text-decoration: underline;
  text-decoration-color: rgba(157, 184, 255, 0.35);
  text-underline-offset: 3px;
}

button.link:hover:not(:disabled) {
  transform: none;
  color: #fff;
  box-shadow: none;
  text-decoration-color: currentColor;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.auth-panel .actions {
  margin-top: 22px;
}

.auth-panel .actions button {
  width: 100%;
  padding-block: 12px;
}

/* ---------- entering-BOT status ---------- */

.status-panel {
  max-width: 460px;
  margin: clamp(40px, 12vh, 120px) auto 0;
  padding: 40px clamp(22px, 4vw, 34px);
  text-align: center;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.018));
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.view-title {
  margin: 0 0 10px;
  font-size: clamp(1.45rem, 2.6vw, 1.95rem);
  letter-spacing: -0.022em;
}

.hint {
  margin: 0;
  font-size: 0.83rem;
  line-height: 1.65;
  color: var(--muted);
}

.status-panel .actions {
  justify-content: center;
  margin-top: 24px;
}

/* ---------- state text ---------- */

.err {
  margin: 14px 0 0;
  font-size: 0.82rem;
  color: var(--err);
}

.err:empty {
  display: none;
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--accent-3);
  animation: spin 0.75s linear infinite;
}

.status-spinner {
  width: 34px;
  height: 34px;
  border-width: 3px;
  margin-bottom: 20px;
}

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

/* ---------- misc ---------- */

.hidden {
  display: none !important;
}

code {
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.07);
  font-family: var(--mono);
  font-size: 0.77rem;
  color: #b8c4ea;
}

/* ---------- responsive ---------- */

@media (max-width: 940px) {
  .auth-screen {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .lead {
    max-width: none;
  }
}

@media (max-width: 560px) {
  .topbar {
    padding: 12px 16px;
  }

  .topbar-meta {
    display: none;
  }

  .shell {
    padding-top: 26px;
  }

  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .actions button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
