/* ============================================================
 * 登录页 · 清华紫主题
 * 主色：清华紫 #660874（PANTONE 259C / RGB 102,8,116）
 * ============================================================ */
/* ---------- 手写艺术字（优先本机楷体，缺失时回退本地字体文件） ---------- */
@font-face {
  font-family: "HeroHand";
  src: local("KaiTi"), local("KaiTi_GB2312"), local("楷体"), local("STKaiti"), local("Kaiti SC"),
       url("../fonts/hero-hand.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

.auth-body {
  --thu: #660874;
  --thu-deep: #4f065a;
  --thu-light: #8e1794;
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 34px 20px;
  background: #4a0451 url("../img/auth-bg.svg") center center / cover no-repeat fixed;
  position: relative;
  overflow-x: hidden;
  color: #fff;
}
/* 暗角，保证左侧文字与右侧白卡的对比度 */
.auth-body::after {
  content: "";
  position: fixed; inset: 0; pointer-events: none;
  background:
    radial-gradient(1100px 700px at 12% 20%, rgba(255, 255, 255, .10), transparent 60%),
    radial-gradient(900px 600px at 92% 96%, rgba(0, 0, 0, .28), transparent 62%),
    linear-gradient(100deg, rgba(38, 0, 44, .38) 0%, rgba(38, 0, 44, .10) 46%, rgba(38, 0, 44, .30) 100%);
  z-index: 0;
}

/* 数理化元素漂浮装饰 */
.deco-syms {
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none; overflow: hidden;
}
.deco-syms span {
  position: absolute; left: var(--x); top: var(--y);
  font-size: var(--s, 20px); font-weight: 700;
  font-family: Georgia, "Times New Roman", serif;
  color: rgba(255, 255, 255, .85); opacity: .16;
  white-space: nowrap;
  text-shadow: 0 2px 12px rgba(20, 0, 24, .3);
  animation: syms-float 9s ease-in-out infinite;
  animation-delay: var(--d, 0s);
}
@keyframes syms-float {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50%      { transform: translateY(-14px) rotate(5deg); }
}

.auth-shell {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: minmax(0, 1fr) 452px;
  gap: 56px; align-items: center;
  width: min(1120px, 100%);
}

/* ---------- 左侧品牌区（透明，直接压在紫色背景上） ---------- */
.auth-brand { position: relative; color: #fff; padding: 6px 0 6px 4px; }

.brand-logo { display: flex; align-items: center; gap: 14px; }
.brand-logo .logo-mark {
  width: 66px; height: 66px; border-radius: 17px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: #fff; overflow: hidden;
  box-shadow: 0 12px 30px rgba(24, 0, 28, .42), 0 0 0 1px rgba(255, 255, 255, .55);
}
.brand-logo .logo-mark img {
  width: 100%; height: 100%; object-fit: contain; display: block;
}
.brand-name {
  font-size: 26px; font-weight: 800; letter-spacing: 3px;
  text-shadow: 0 2px 12px rgba(30, 0, 34, .3);
}
.brand-en {
  font-size: 10.5px; letter-spacing: 2.4px; opacity: .62;
  writing-mode: horizontal-tb; padding-top: 12px; font-weight: 600;
}

/* ---------- 主标语：原图毛笔艺术字 · 墨迹书写渐显 + 光晕凸显 ---------- */
.auth-brand h1.hero-ink {
  --ink-h: 82px;
  margin: 32px 0 16px;
  font-size: 0;
  line-height: 0;
}
.hero-ink .ink-line {
  display: block;
  opacity: 0;
  transform: translateY(16px) scale(.97);
  transform-origin: left center;
  -webkit-mask-image: linear-gradient(90deg, #000 0 44%, transparent 56% 100%);
          mask-image: linear-gradient(90deg, #000 0 44%, transparent 56% 100%);
  -webkit-mask-size: 220% 100%;
          mask-size: 220% 100%;
  -webkit-mask-position: 100% 0;
          mask-position: 100% 0;
  animation:
    ink-write 2s cubic-bezier(.42, 0, .58, 1) forwards,
    ink-rise  1.6s ease-in-out forwards;
}
.hero-ink .ink-line-2 {
  margin-top: 6px;
  animation-delay: .7s, .7s;
}
.hero-ink .ink-line img {
  display: block;
  width: auto;
  height: var(--ink-h);
  animation: ink-breathe 4.8s ease-in-out 3.2s infinite;
}
/* 由左至右如运笔般渐渐写出 */
@keyframes ink-write {
  from { -webkit-mask-position: 100% 0; mask-position: 100% 0; }
  to   { -webkit-mask-position: 0% 0;   mask-position: 0% 0; }
}
/* 墨迹由虚到实：模糊 → 聚焦，由暗转亮、轻微上浮凸显 */
@keyframes ink-rise {
  0%   { opacity: 0; transform: translateY(16px) scale(.97); filter: blur(11px) brightness(.55); }
  55%  { opacity: 1; filter: blur(2.2px) brightness(1.3); }
  100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0) brightness(1); }
}
/* 定格后：光晕缓慢呼吸，持续凸显 */
@keyframes ink-breathe {
  0%, 100% { filter: drop-shadow(0 4px 16px rgba(24, 0, 28, .45)) drop-shadow(0 0 3px rgba(255, 255, 255, .10)); }
  50%      { filter: drop-shadow(0 4px 18px rgba(24, 0, 28, .35)) drop-shadow(0 0 22px rgba(255, 214, 244, .58)); }
}

/* ---------- 右侧竖排书法：2~3 字片段悬浮发光，右→左由近及远落位 ---------- */
.hero-verse {
  --verse-h: 300px;
  --verse-w: 187px;
  --verse-final: .42;
  position: absolute;
  top: -48px;
  right: -23px;
  width: 269px;
  height: 442px;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  z-index: 1;
}
.hero-verse-stack {
  position: relative;
  width: var(--verse-w);
  height: var(--verse-h);
}
.hero-verse-stack img {
  position: absolute;
  height: auto;
  max-width: none;
  opacity: 0;
  transform-origin: 50% 38%;
  will-change: transform, translate, opacity, filter;
  /* 四周散乱汇聚 → 悬浮 1.5s → 快速下落原位置；位移与发光分离，避免属性互相覆盖 */
  animation:
    verse-move 3.2s cubic-bezier(.22, .61, .36, 1) var(--delay) both,
    verse-glow 3.2s cubic-bezier(.22, .61, .36, 1) var(--delay) both;
}
/* 每段按原图坐标定位；--sx/--sy 为四周散落起点，--sr 为初始倾角，--ss 为初始放大。
   s01 为最右列首段，依次右→左、列内自上而下。 */
.hero-verse-s01{left:70.736%;top:2.083%;width:26.839%;--delay:.06s;--sx:74px;--sy:-86px;--sr:-8deg;--ss:1.42}
.hero-verse-s02{left:70.736%;top:38.229%;width:26.839%;--delay:.12s;--sx:-62px;--sy:-72px;--sr:7deg;--ss:1.30}
.hero-verse-s03{left:70.736%;top:72.604%;width:26.839%;--delay:.18s;--sx:88px;--sy:36px;--sr:-6deg;--ss:1.36}
.hero-verse-s04{left:47.492%;top:1.354%;width:23.244%;--delay:.24s;--sx:-78px;--sy:-48px;--sr:9deg;--ss:1.28}
.hero-verse-s05{left:47.492%;top:40.104%;width:23.244%;--delay:.30s;--sx:66px;--sy:82px;--sr:-7deg;--ss:1.34}
.hero-verse-s06{left:47.492%;top:77.031%;width:23.244%;--delay:.36s;--sx:-92px;--sy:28px;--sr:5deg;--ss:1.40}
.hero-verse-s07{left:23.077%;top:2.240%;width:24.415%;--delay:.42s;--sx:54px;--sy:-96px;--sr:-9deg;--ss:1.30}
.hero-verse-s08{left:23.077%;top:36.250%;width:24.415%;--delay:.48s;--sx:-80px;--sy:60px;--sr:8deg;--ss:1.36}
.hero-verse-s09{left:23.077%;top:64.323%;width:24.415%;--delay:.54s;--sx:96px;--sy:-22px;--sr:-5deg;--ss:1.42}
.hero-verse-s10{left:1.087%;top:1.615%;width:21.990%;--delay:.60s;--sx:-68px;--sy:-84px;--sr:10deg;--ss:1.28}
.hero-verse-s11{left:1.087%;top:31.042%;width:21.990%;--delay:.66s;--sx:82px;--sy:48px;--sr:-8deg;--ss:1.38}
.hero-verse-s12{left:1.087%;top:53.854%;width:21.990%;--delay:.72s;--sx:-96px;--sy:12px;--sr:6deg;--ss:1.32}
.hero-verse-s13{left:1.087%;top:79.219%;width:21.990%;--delay:.78s;--sx:58px;--sy:92px;--sr:-10deg;--ss:1.44}
@keyframes verse-move {
  0%      { translate: var(--sx) var(--sy); }
  37.5%   { translate: 0 -28px; }
  84.375% { translate: 0 -28px; }
  100%    { translate: 0 0; }
}
@keyframes verse-glow {
  0% {
    opacity: 0;
    transform: scale(var(--ss)) rotate(var(--sr));
    filter: sepia(0) saturate(1) brightness(1.18) blur(11px)
            drop-shadow(0 0 24px rgba(255, 255, 255, .95))
            drop-shadow(0 0 46px rgba(255, 255, 255, .52));
  }
  37.5% {
    opacity: .96;
    transform: scale(1.08) rotate(0deg);
    filter: sepia(0) saturate(1.05) brightness(1.12) blur(0)
            drop-shadow(0 0 14px rgba(255, 255, 255, .85))
            drop-shadow(0 0 30px rgba(255, 255, 255, .38));
  }
  84.375% {
    opacity: .96;
    transform: scale(1.08) rotate(0deg);
    filter: sepia(0) saturate(1.05) brightness(1.12) blur(0)
            drop-shadow(0 0 14px rgba(255, 255, 255, .85))
            drop-shadow(0 0 30px rgba(255, 255, 255, .38));
  }
  100% {
    opacity: var(--verse-final);
    transform: scale(1) rotate(0deg);
    filter: sepia(.10) saturate(1.10) brightness(1) blur(0)
            drop-shadow(0 0 7px rgba(255, 236, 170, .30))
            drop-shadow(0 0 14px rgba(255, 216, 130, .12));
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-ink .ink-line,
  .hero-ink .ink-line img { animation: none; }
  .hero-ink .ink-line {
    opacity: 1; transform: none; filter: none;
    -webkit-mask-image: none; mask-image: none;
  }
  .hero-verse-stack img {
    animation: none; opacity: var(--verse-final); transform: none; translate: none;
    filter: sepia(.10) saturate(1.10) brightness(1)
            drop-shadow(0 0 7px rgba(255, 236, 170, .30))
            drop-shadow(0 0 14px rgba(255, 216, 130, .12));
  }
}
.auth-brand .tagline {
  font-size: 16.5px; font-weight: 600; letter-spacing: .6px;
  opacity: .95;
}
.auth-brand .brand-desc {
  margin-top: 12px; font-size: 14px; line-height: 1.85;
  max-width: 460px; opacity: .78;
}

.auth-feats {
  margin-top: 34px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  max-width: 520px;
}
.auth-feat {
  display: flex; gap: 11px; align-items: flex-start;
  background: rgba(255, 255, 255, .09);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 13px; padding: 12px 13px;
  backdrop-filter: blur(3px);
  transition: background .18s, border-color .18s, transform .18s;
}
.auth-feat:hover { background: rgba(255, 255, 255, .15); border-color: rgba(255, 255, 255, .3); transform: translateY(-2px); }
.auth-feat .ic {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .24);
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.auth-feat b { display: block; font-size: 13.5px; letter-spacing: .3px; }
.auth-feat span { font-size: 12px; opacity: .72; line-height: 1.55; }

.auth-brand .deco {
  margin-top: 34px; opacity: .42; font-size: 12.5px;
  font-family: Georgia, "Times New Roman", serif; font-style: italic; letter-spacing: .5px;
}

/* ---------- 右侧表单卡 ---------- */
.auth-panel {
  background: #fff; color: var(--ink);
  border-radius: 24px;
  padding: 30px 36px 30px;
  box-shadow: 0 30px 80px rgba(24, 0, 28, .42), 0 2px 0 rgba(255, 255, 255, .5) inset;
  border: 1px solid rgba(255, 255, 255, .6);
}

/* 登录卡上方 · Logo + 正下方 slogan */
.panel-logo {
  display: flex; flex-direction: column; align-items: center;
  margin: -2px 0 22px; text-align: center;
}
.panel-logo img {
  width: 92px; height: 92px; object-fit: contain; display: block;
  border-radius: 19px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(102, 8, 116, .18), 0 0 0 3px rgba(102, 8, 116, .10);
}
.panel-logo span {
  margin-top: 10px;
  font-family: "HeroHand", "KaiTi", "楷体", serif;
  font-size: 14px; letter-spacing: 2.4px; color: #7c6882;
  line-height: 1.2; white-space: nowrap;
}
.auth-tabs { display: flex; background: #f4f1f6; border-radius: 12px; padding: 4px; margin-bottom: 24px; }
.auth-tabs button {
  flex: 1; border: none; background: transparent; padding: 9px 0;
  border-radius: 9px; font-size: 15px; font-weight: 600; color: var(--muted);
  transition: all .15s;
}
.auth-tabs button.active { background: #fff; color: var(--thu); box-shadow: 0 1px 3px rgba(23, 26, 43, .1); }
.auth-panel h2 { font-size: 20px; margin-bottom: 4px; }
.auth-panel .sub { color: var(--muted); font-size: 13.5px; margin-bottom: 20px; }
.auth-form .btn-primary { width: 100%; justify-content: center; margin-top: 6px; }
.auth-alt { text-align: center; margin-top: 16px; font-size: 13.5px; color: var(--muted); }
.auth-alt a { font-weight: 600; color: var(--thu); }
.auth-tip {
  margin-top: 20px; padding-top: 15px; border-top: 1px dashed var(--line);
  font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; align-items: flex-start;
}
.auth-tip a { color: var(--thu); }
.form-err { color: var(--danger); font-size: 13px; min-height: 20px; margin: 2px 0 6px; }

/* ---------- 注册 · 身份（学生 / 老师）与任教学科 ---------- */
.role-seg { display: flex; gap: 8px; }
.role-seg button {
  flex: 1; border: 1.5px solid var(--line); background: #faf8fb; color: var(--ink);
  border-radius: 10px; padding: 10px 0; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all .15s;
}
.role-seg button:hover { border-color: #c9a6d4; }
.role-seg button.active {
  background: #f8f1f9; border-color: var(--thu); color: var(--thu);
  box-shadow: 0 0 0 3px rgba(102, 8, 116, .10);
}
.role-hint { margin: 7px 0 0; font-size: 12px; color: var(--muted); line-height: 1.6; }

/* 表单控件聚焦色统一为清华紫 */
.auth-panel .input:focus { border-color: var(--thu); box-shadow: 0 0 0 3px rgba(102, 8, 116, .12); }
.auth-panel .btn-primary {
  background: linear-gradient(135deg, #7b0f6b 0%, #660874 55%, #4f065a 100%);
  box-shadow: 0 8px 20px rgba(102, 8, 116, .28);
}
.auth-panel .btn-primary:hover { filter: brightness(1.08); }

/* ---------- 微信登录 ---------- */
.auth-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 18px 0 14px; color: var(--muted); font-size: 12px;
}
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.btn-wx {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: #07c160; color: #fff; border: none; border-radius: 10px;
  padding: 11px 18px; font-size: 15px; font-weight: 600;
  box-shadow: 0 4px 12px rgba(7, 193, 96, .25); transition: filter .15s;
}
.btn-wx:hover { filter: brightness(.95); }
.btn-wx .wx-ic { font-size: 17px; }
.btn-wx-sm { width: auto; padding: 9px 18px; font-size: 14px; }
.wx-note { text-align: center; font-size: 12px; color: var(--muted); margin-top: 8px; }
.wx-note b { color: var(--warn); }
.wx-reg-note {
  background: #f0f9f3; border: 1px solid #b7e4c7; border-radius: 10px;
  padding: 10px 12px; margin-bottom: 16px; color: #1e6b3a;
  font-size: 12.5px; line-height: 1.7;
}
.wx-reg-note b { color: #155a30; }
.wx-cfg-link {
  display: block; width: 100%; text-align: center; margin-top: 8px;
  background: transparent; border: none; color: var(--muted);
  font-size: 12.5px; text-decoration: underline; text-underline-offset: 3px;
}
.wx-cfg-link:hover { color: var(--thu); }
.wx-demo-warn, .wx-cfg-tip {
  font-size: 13px; color: #565c78; line-height: 1.8;
  background: #f8f1f9; border-radius: 10px; padding: 10px 13px; margin-bottom: 14px;
}
.wx-demo-warn b { color: var(--warn); }
.wx-cfg-tip { background: #ecfdf5; }
.wx-cfg-tip code, .wx-api-doc code {
  background: rgba(15, 23, 42, .07); border-radius: 4px; padding: 1px 5px;
  font-family: Consolas, "Courier New", monospace; font-size: 12px;
}
.wx-api-doc {
  font-size: 12px; color: var(--muted); line-height: 1.9;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 9px; padding: 10px 12px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 1040px) {
  .auth-shell { grid-template-columns: minmax(0, 1fr) 420px; gap: 32px; }
  .auth-brand h1.hero-ink { --ink-h: 68px; }
  /* 宽度不足以容纳标语与竖排书法并排，改为标语下方顺排 */
  .hero-verse {
    --verse-h: 250px; --verse-w: 156px;
    position: relative; top: auto; right: auto;
    width: fit-content; max-width: 100%;
    height: var(--verse-h); margin: 8px 0 0;
  }
}
@media (max-width: 900px) {
  .auth-body { padding: 24px 16px; align-items: flex-start; }
  .auth-shell { grid-template-columns: 1fr; gap: 22px; justify-items: stretch; }
  .auth-brand { text-align: left; }
  .auth-brand h1.hero-ink { --ink-h: 48px; margin: 20px 0 8px; }
  .auth-brand .brand-desc, .auth-feats, .auth-brand .deco, .brand-en { display: none; }
  .deco-syms { display: none; }
  .auth-brand .tagline { font-size: 14px; opacity: .85; }
  .hero-verse { --verse-h: 210px; --verse-w: 131px; height: var(--verse-h); margin: 6px 0 4px; }
  .auth-panel { padding: 26px 22px 22px; border-radius: 20px; }
}
