/* ============================================================
   无界云控 · 统一视觉 — Telegram 结构 + 液态玻璃材质
   令牌来源：web-ui references/telegram-style.md
   材质来源：web-ui references/liquid-glass.md
   ============================================================ */

:root {
  /* ---- Telegram 色彩令牌（暗色为默认） ---- */
  --bg:            #0e1621;
  --sidebar-bg:    #17212b;
  --chat-bg:       #0e1621;
  --primary:       #3390ec;
  --primary-hover: #4aa3f0;
  --text:          #ffffff;
  --text-2:        #7f8fa6;
  --divider:       rgba(255,255,255,.08);
  --bubble-in:     #182533;
  --bubble-out:    #2b5278;
  --hover:         #202b36;
  --active:        #2b5278;
  --badge:         #3d7ec2;
  --badge-mute:    #3d4750;
  --input-bg:      #17212b;
  --error:         #ef5350;
  --ok:            #34d399;

  /* ---- 液态玻璃场景（彩色渐变 + 光斑，玻璃的光学燃料） ---- */
  --scene:
    radial-gradient(42% 46% at 18% 22%, #2b4a8f 0%, transparent 60%),
    radial-gradient(38% 42% at 82% 18%, #1d6fb8 0%, transparent 62%),
    radial-gradient(46% 50% at 72% 84%, #6d3d8f 0%, transparent 60%),
    radial-gradient(40% 44% at 22% 82%, #1a7f7a 0%, transparent 58%),
    #0b0e1a;

  /* ---- 玻璃材质层 ---- */
  --glass-surface: rgba(255,255,255,.07);
  --glass-strong:  rgba(255,255,255,.12);
  --glass-border:  rgba(255,255,255,.16);
  --hl-top:        rgba(255,255,255,.40);
  --hl-bottom:     rgba(255,255,255,.10);
  --ring:          linear-gradient(135deg,
                     rgba(255,255,255,.55), rgba(255,255,255,.06) 40%,
                     rgba(255,255,255,0) 62%, rgba(255,255,255,.28));
  --shadow:        0 12px 40px rgba(0,0,0,.28);
  --orb-blend:     screen;

  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
          Roboto, "Helvetica Neue", Arial, "PingFang SC",
          "Microsoft YaHei", sans-serif;
}

[data-theme="light"] {
  --bg:            #ffffff;
  --sidebar-bg:    #ffffff;
  --chat-bg:       #f4f4f5;
  --text:          #000000;
  --text-2:        #707579;
  --divider:       #e6e6e6;
  --bubble-in:     #ffffff;
  --bubble-out:    #effdde;
  --hover:         #f4f4f5;
  --active:        #e9e9e9;
  --badge:         #3390ec;
  --badge-mute:    #c4c9cc;
  --input-bg:      #f4f4f5;
  --error:         #e53935;

  --scene:
    radial-gradient(42% 46% at 18% 22%, #c4b5fd 0%, transparent 60%),
    radial-gradient(38% 42% at 82% 18%, #93c5fd 0%, transparent 62%),
    radial-gradient(46% 50% at 72% 84%, #f9a8d4 0%, transparent 60%),
    radial-gradient(40% 44% at 22% 82%, #99f6e4 0%, transparent 58%),
    #eef2ff;

  --glass-surface: rgba(255,255,255,.42);
  --glass-strong:  rgba(255,255,255,.58);
  --glass-border:  rgba(255,255,255,.65);
  --hl-top:        rgba(255,255,255,.75);
  --hl-bottom:     rgba(255,255,255,.35);
  --ring:          linear-gradient(135deg,
                     rgba(255,255,255,.9), rgba(255,255,255,.3) 40%,
                     rgba(255,255,255,0) 62%, rgba(255,255,255,.5));
  --shadow:        0 8px 24px rgba(31,41,55,.16);
  --orb-blend:     normal;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { min-height: 100%; }

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--scene);
  background-attachment: fixed;
  overflow-x: hidden;
  transition: color .3s ease;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
a { color: var(--primary); text-decoration: none; }

/* ---------- 漂移光斑（折射与聚光的动态素材） ---------- */
.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(70px);
  mix-blend-mode: var(--orb-blend);
  pointer-events: none;
  z-index: 0;
}
.orb--1 { width: 46vw; height: 46vw; left: -10vw; top: -12vw;
          background: radial-gradient(circle, rgba(43,74,143,.85), transparent 65%);
          animation: drift1 26s ease-in-out infinite alternate; }
.orb--2 { width: 40vw; height: 40vw; right: -8vw; top: 10vh;
          background: radial-gradient(circle, rgba(29,111,184,.8), transparent 65%);
          animation: drift2 32s ease-in-out infinite alternate; }
.orb--3 { width: 44vw; height: 44vw; left: 30vw; bottom: -18vw;
          background: radial-gradient(circle, rgba(109,61,143,.75), transparent 65%);
          animation: drift3 38s ease-in-out infinite alternate; }

@keyframes drift1 { to { transform: translate(9vw, 7vh) scale(1.12); } }
@keyframes drift2 { to { transform: translate(-8vw, 10vh) scale(.92); } }
@keyframes drift3 { to { transform: translate(-11vw, -8vh) scale(1.08); } }

/* ---------- 玻璃基类（三层结构的表面层） ---------- */
.glass {
  position: relative;
  border-radius: 28px;
  background: var(--glass-surface);
  -webkit-backdrop-filter: blur(18px) saturate(180%) brightness(1.06);
          backdrop-filter: blur(18px) saturate(180%) brightness(1.06);
  box-shadow:
    inset 0 1px 1px var(--hl-top),
    inset 0 -1px 1px var(--hl-bottom),
    var(--shadow);
  overflow: hidden;
  isolation: isolate;
  transition: transform .25s ease, box-shadow .25s ease;
}

/* 镜头①：边缘高光环（1px 渐变描边） */
.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--ring);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  z-index: 3;
}

/* 镜头④：跟随指针的镜面光泽 */
.glass::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(160px circle at var(--mx, 50%) var(--my, 50%),
              rgba(255,255,255,.28), transparent 65%);
  opacity: 0;
  transition: opacity .35s ease;
  pointer-events: none;
  z-index: 2;
}
.glass:hover::after { opacity: 1; }
.glass.glass--lift:hover { transform: translateY(-2px); }
.glass:active { transform: scale(.985); transition-duration: .12s; }

/* 镜头①：折射层（背景副本 + SVG 位移） */
.glass__lens {
  position: absolute;
  inset: 0;
  background: var(--scene);
  background-attachment: fixed;
  filter: url(#lg-refraction);
  z-index: 0;
  pointer-events: none;
}

/* 内容层 */
.glass__content {
  position: relative;
  z-index: 1;
}

/* ---------- 登录/表单卡片 ---------- */
.auth-wrap {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px 56px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 38px 34px 32px;
}

.auth-logo {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--primary);
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  box-shadow: 0 6px 18px rgba(51,144,236,.35);
  position: relative;
}
.auth-logo svg { width: 32px; height: 32px; color: #fff; }

/* 品牌字标「无界」 */
.auth-brand {
  display: block;
  text-align: center;
  font-family: var(--font);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 6px;
  margin: 0 0 6px;
  background: linear-gradient(120deg, var(--primary), #7c5cff 55%, var(--primary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.auth-brand::after {
  content: '';
  display: block;
  width: 36px; height: 3px;
  margin: 8px auto 0;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
}

.auth-title {
  font-size: 22px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 8px;
  margin-top: 10px;
}

/* 登录卡顶部装饰条 */
.auth-card::before {
  content: '';
  position: absolute;
  top: 0; left: 22px; right: 22px;
  height: 3px;
  border-radius: 0 0 6px 6px;
  background: linear-gradient(90deg, transparent, var(--primary), #7c5cff, transparent);
  opacity: .85;
  z-index: 2;
}

/* 卡片周围浮动玻璃徽章 */
.auth-deco {
  position: absolute;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  border-radius: 9999px;
  font-size: 12px;
  color: var(--text-2);
  background: var(--glass-surface);
  border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  backdrop-filter: blur(12px) saturate(160%);
  box-shadow: 0 8px 22px rgba(0,0,0,.12);
  pointer-events: none;
  animation: auth-float 6s ease-in-out infinite;
}
.auth-deco i {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 8px rgba(51,144,236,.7);
}
.auth-deco--a { top: 12%; left: 8%; animation-delay: 0s; }
.auth-deco--b { top: 22%; right: 7%; animation-delay: 1.2s; }
.auth-deco--c { bottom: 18%; left: 10%; animation-delay: 2.1s; }
.auth-deco--d { bottom: 26%; right: 9%; animation-delay: 3s; }
@keyframes auth-float {
  0%, 100% { transform: translateY(0) }
  50% { transform: translateY(-10px) }
}

/* 底部能力胶囊 */
.auth-features {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 22px 0 0;
}
.auth-features span {
  font-size: 11.5px;
  padding: 5px 11px;
  border-radius: 9999px;
  color: var(--primary);
  background: rgba(51,144,236,.1);
  border: 1px solid rgba(51,144,236,.22);
  letter-spacing: .3px;
}

.auth-hint {
  font-size: 15px;
  color: var(--text-2);
  text-align: center;
  margin-bottom: 24px;
  line-height: 1.5;
}

/* ---------- 表单字段 ---------- */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 7px;
}

.input {
  width: 100%;
  height: 44px;
  border: 1.5px solid var(--divider);
  border-radius: 16px;
  background: var(--glass-strong);
  padding: 0 14px;
  font-size: 15px;
  outline: none;
  transition: border-color .12s ease-out, background-color .12s ease-out;
  -webkit-backdrop-filter: blur(10px) saturate(160%);
          backdrop-filter: blur(10px) saturate(160%);
}
.input::placeholder { color: var(--text-2); }
.input:focus { border-color: var(--primary); }
.input.has-error { border-color: var(--error); }
input[type="password"].input, input[inputmode="numeric"].input { letter-spacing: .3px; }

textarea.input {
  height: auto;
  min-height: 88px;
  padding: 11px 14px;
  line-height: 1.5;
  resize: vertical;
  border-radius: 16px;
}

/* 验证码组合行 */
.cap-row { display: flex; gap: 10px; align-items: stretch; }
.cap-row .input { flex: 1; min-width: 0; }
.cap-q {
  flex-shrink: 0;
  height: 44px;
  padding: 0 14px;
  border: 1.5px solid var(--divider);
  border-radius: 16px;
  background: var(--glass-strong);
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-weight: 600;
  font-size: 15px;
  color: var(--primary);
  white-space: nowrap;
}
.cap-q a { color: var(--primary); font-size: 16px; }

/* 主按钮 */
.btn {
  width: 100%;
  height: 44px;
  border-radius: 16px;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  margin-top: 8px;
  transition: background-color .12s ease-out, transform .1s ease-out;
}
.btn:hover { background: var(--primary-hover); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-inline {
  width: auto;
  padding: 0 18px;
  flex-shrink: 0;
  margin-top: 0;
}

.link-btn {
  color: var(--primary);
  font-size: 15px;
  border-radius: 8px;
  padding: 2px 6px;
  transition: opacity .12s ease-out;
}
.link-btn:hover { opacity: .82; }

/* 错误提示 */
.err {
  display: flex;
  gap: 8px;
  align-items: center;
  background: rgba(239,83,80,.12);
  border: 1px solid rgba(239,83,80,.4);
  color: var(--error);
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 14px;
  margin-bottom: 18px;
}
.ok-msg {
  background: rgba(52,211,153,.12);
  border: 1px solid rgba(52,211,153,.4);
  color: var(--ok);
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 14px;
  margin-bottom: 18px;
}

.auth-foot {
  margin-top: 22px;
  text-align: center;
  font-size: 14px;
  color: var(--text-2);
}
.auth-foot a { font-weight: 500; }

/* 主题切换（右上角） */
.auth-theme {
  position: absolute;
  top: 16px; right: 16px;
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--text-2);
  z-index: 5;
  transition: background-color .12s ease-out, color .12s ease-out;
}
.auth-theme:hover { background: var(--hover); color: var(--text); }
.auth-theme svg { width: 20px; height: 20px; }

/* 动效偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}
