/* 统一登录页：深蓝宇宙科技背景 + 左侧3D地球 + 右侧玻璃拟态登录面板。
   16:9 横屏优先，平板与窄屏自动堆叠。配色与首页/工作台共用一套变量。 */
:root {
  --c-deep: #06152f;
  --c-navy: #0b2b61;
  --c-blue: #168bff;
  --c-cyan: #32dfff;
  --c-text: #eaf3ff;
  --c-sub: #a8c2e8;
  --c-line: rgba(50, 223, 255, 0.24);
  --c-err: #ff9a9a;
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC", "Hiragino Sans GB", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--c-deep) radial-gradient(ellipse at 35% 30%, #0d2958, var(--c-deep) 72%) no-repeat;
  color: var(--c-text);
  font: 15px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: #8fe9ff; }
:focus-visible { outline: 2px solid var(--c-cyan); outline-offset: 2px; }
[hidden] { display: none !important; }

.login-page { position: relative; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(380px, 0.85fr); height: 100%; }

/* ---------- 背景：星空与光晕 ---------- */
.bg-stars, .bg-glow { position: fixed; inset: 0; pointer-events: none; }
.bg-stars { background-repeat: repeat; opacity: 0.75; }
.bg-glow {
  background:
    radial-gradient(ellipse 700px 420px at 22% 18%, rgba(22, 139, 255, 0.18), transparent 62%),
    radial-gradient(ellipse 560px 360px at 74% 78%, rgba(50, 223, 255, 0.13), transparent 58%),
    radial-gradient(ellipse 420px 300px at 50% 50%, rgba(108, 61, 255, 0.10), transparent 65%);
}

/* ---------- 左侧视觉区 ---------- */
.visual { position: relative; min-width: 0; overflow: hidden; }
.visual-inner { position: relative; z-index: 2; display: flex; flex-direction: column; height: 100%; padding: 28px 32px 34px; }

.v-brand { display: inline-flex; align-items: center; gap: 12px; color: var(--c-text); text-decoration: none; align-self: flex-start; }
.v-logo { width: 42px; height: 42px; flex: none; }
.v-brand-text b { display: block; font-size: 21px; letter-spacing: 0.4px; }
.v-brand-text small { display: block; color: var(--c-sub); font-size: 12.5px; letter-spacing: 0.6px; }

/* 3D 地球舞台 */
.v-stage { position: relative; flex: 1; min-height: 240px; margin: 6px 0; }
/* 画布与标签层必须脱离文档流（与 home.css 的 .stage-canvas / .stage-labels 一致）。
   stage.js 每帧把 CSS2DRenderer 的尺寸写成内联像素值；如果 .stage-labels 留在普通流里，
   它会把 .v-stage 撑高，ResizeObserver 读到更大的尺寸再写回更大的值，两者互相放大：
   容器高度会一路涨到上百万像素，画布尺寸超过显卡上限（16K），
   WebGL 每帧报错、帧缓冲不完整，页面持续闪烁。窄屏（≤860px）时 .v-stage 的高度由内容决定，
   所以手机和微信内置浏览器（窗口很窄）必现，普通宽屏电脑看不到。 */
.v-stage canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.stage-labels { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.v-fallback { position: absolute; inset: 0; display: grid; place-content: center; gap: 14px; text-align: center; padding: 24px; }
.v-fallback p { margin: 0; color: var(--c-sub); max-width: 30ch; }
.v-fallback-globe {
  width: 190px; height: 190px; margin: 0 auto; border-radius: 50%;
  background: radial-gradient(circle at 34% 32%, #9fe2ff, #2f8cff 52%, #16306f 100%);
  box-shadow: 0 0 60px rgba(50, 223, 255, 0.35), inset -18px -14px 46px rgba(0, 0, 0, 0.45);
}

.v-copy { max-width: 34rem; }
.v-copy h1 { margin: 0 0 10px; font-size: clamp(24px, 2.5vw, 34px); line-height: 1.28; letter-spacing: 0.6px; }
.v-lead { margin: 0 0 18px; color: #bfe0ff; font-size: 15px; }
.v-points { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 0; padding: 0; list-style: none; color: var(--c-sub); font-size: 13.5px; }
.v-points li { display: inline-flex; align-items: center; gap: 8px; }

/* ---------- 右侧登录面板 ---------- */
.panel-col { position: relative; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: safe center; gap: 14px; padding: 28px 34px; max-height: 100%; overflow-y: auto; }
.panel {
  width: min(420px, 100%); padding: 30px 30px 22px; border-radius: 22px;
  background: rgba(11, 43, 97, 0.42);
  border: 1px solid var(--c-line);
  box-shadow: 0 24px 60px rgba(2, 10, 28, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(18px) saturate(140%);
}
.panel-head h2 { margin: 0; font-size: 20px; letter-spacing: 0.5px; }
.panel-head p { margin: 5px 0 20px; color: var(--c-sub); font-size: 13.5px; }

/* 身份卡片 */
.roles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.role {
  position: relative; display: flex; flex-direction: column; gap: 8px; align-items: flex-start;
  padding: 16px 14px 14px; border-radius: 16px; text-align: left;
  background: rgba(6, 21, 47, 0.5); border: 1px solid rgba(50, 223, 255, 0.18);
  color: var(--c-text); transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s, background 0.2s;
}
.role:hover { transform: translateY(-2px); border-color: rgba(50, 223, 255, 0.42); }
.role[aria-checked="true"] {
  background: linear-gradient(160deg, rgba(22, 139, 255, 0.32), rgba(50, 223, 255, 0.14));
  border-color: var(--c-cyan);
  box-shadow: 0 0 0 1px rgba(50, 223, 255, 0.5), 0 12px 30px rgba(22, 139, 255, 0.32);
}
.role-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: rgba(50, 223, 255, 0.14); color: #9fe4ff; }
.role[aria-checked="true"] .role-icon { color: #eafcff; background: rgba(255, 255, 255, 0.16); }
.role-icon svg { width: 26px; height: 26px; }
.role-text b { display: block; font-size: 15.5px; }
.role-text small { display: block; color: var(--c-sub); font-size: 12.5px; line-height: 1.5; }
.role[aria-checked="true"] .role-text small { color: #d5f0ff; }
.role-check { position: absolute; top: 12px; right: 12px; width: 20px; height: 20px; border-radius: 50%; border: 1.6px solid rgba(50, 223, 255, 0.4); display: grid; place-items: center; opacity: 0; transition: opacity 0.2s; }
.role-check svg { width: 13px; height: 13px; fill: none; stroke: #06152f; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.role[aria-checked="true"] .role-check { opacity: 1; background: var(--c-cyan); border-color: var(--c-cyan); }

/* 表单 */
.login-form { display: flex; flex-direction: column; gap: 14px; }
.form-note { margin: 0; color: var(--c-sub); font-size: 13px; }
.form-note b { color: #9fe4ff; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { color: var(--c-sub); font-size: 13px; }
.field-label em { font-style: normal; color: #7fa3d4; font-size: 12px; }
.field-input { position: relative; display: flex; align-items: center; }
.field-icon { position: absolute; left: 12px; width: 19px; height: 19px; color: #7fa3d4; pointer-events: none; }
.field-input input {
  width: 100%; padding: 12px 44px 12px 40px; border-radius: 12px;
  background: rgba(4, 14, 34, 0.62); border: 1px solid rgba(50, 223, 255, 0.22);
  color: var(--c-text); transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.field-input input::placeholder { color: #6d8bb8; }
.field-input input:focus { outline: none; border-color: var(--c-cyan); box-shadow: 0 0 0 3px rgba(50, 223, 255, 0.18); background: rgba(4, 14, 34, 0.8); }
.field-input input:-webkit-autofill { -webkit-text-fill-color: var(--c-text); transition: background-color 9999s; }
.reveal { position: absolute; right: 6px; display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 9px; background: none; color: #7fa3d4; }
.reveal:hover { color: var(--c-cyan); background: rgba(50, 223, 255, 0.1); }
.reveal svg { width: 19px; height: 19px; }
.reveal .i-eye-off { display: none; }
.reveal[aria-pressed="true"] .i-eye { display: none; }
.reveal[aria-pressed="true"] .i-eye-off { display: block; }

.msg { min-height: 20px; margin: 0; color: var(--c-err); font-size: 13px; }
.msg.ok { color: #6ee7a8; }
.msg:empty { min-height: 0; }

.submit {
  padding: 13px 20px; border: 0; border-radius: 12px; font-size: 16px; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, var(--c-blue), var(--c-cyan));
  box-shadow: 0 10px 26px rgba(22, 139, 255, 0.35);
  transition: box-shadow 0.2s, transform 0.2s, opacity 0.2s;
}
.submit:hover:not(:disabled) { box-shadow: 0 0 22px rgba(50, 223, 255, 0.6), 0 12px 30px rgba(22, 139, 255, 0.4); transform: translateY(-1px); }
.submit:disabled { opacity: 0.55; cursor: progress; }

.switch-back { margin: 2px 0 0; color: var(--c-sub); font-size: 13.5px; text-align: center; }
.switch-back a { font-weight: 600; }

/* ---------- 注册 ---------- */
.reg-group { display: flex; flex-direction: column; gap: 14px; }
.field-input.plain input, .field-input.plain select { padding: 11px 14px; }
.field-input select {
  width: 100%; border-radius: 12px; background: rgba(4, 14, 34, 0.62); border: 1px solid rgba(50, 223, 255, 0.22);
  color: var(--c-text); transition: border-color 0.2s, box-shadow 0.2s;
}
.field-input select:focus { outline: none; border-color: var(--c-cyan); box-shadow: 0 0 0 3px rgba(50, 223, 255, 0.18); }
.field-input select option { background: #0b2b61; color: var(--c-text); }
.field.bad .field-input input, .field.bad .field-input select { border-color: var(--c-err); }
.privacy { border: 1px solid rgba(50, 223, 255, 0.2); border-radius: 12px; background: rgba(4, 14, 34, 0.45); font-size: 13px; }
.privacy summary { padding: 9px 12px; cursor: pointer; color: #8fe9ff; }
.privacy-body { max-height: 240px; overflow-y: auto; padding: 0 12px 10px; color: var(--c-sub); line-height: 1.7; }
.privacy-body h3 { margin: 10px 0 2px; font-size: 13.5px; color: var(--c-text); }
.privacy-body p { margin: 0; }
.privacy-body .ver { margin-top: 8px; color: #7fa3d4; font-size: 12px; }
.check { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; line-height: 1.6; color: var(--c-text); cursor: pointer; }
.check input { flex: none; width: 17px; height: 17px; margin-top: 2px; accent-color: var(--c-cyan); }
.check.bad span { color: var(--c-err); }
.reg-note { margin: 8px 0 0; color: #ffe17a; font-size: 12.5px; line-height: 1.6; }
.reg-done { padding: 14px 16px; border-radius: 14px; background: rgba(110, 231, 168, 0.12); border: 1px solid rgba(110, 231, 168, 0.4); line-height: 1.7; }
.reg-done b { display: block; font-size: 16px; color: #6ee7a8; }
.reg-done p { margin: 4px 0 0; color: var(--c-text); font-size: 14px; }
.panel-foot { display: flex; gap: 10px; justify-content: center; margin-top: 18px; padding-top: 14px; border-top: 1px solid rgba(50, 223, 255, 0.14); font-size: 13px; }
.panel-foot span { color: #5f7ba6; }
.panel-tip { margin: 0; color: #7fa3d4; font-size: 12.5px; }

/* ---------- 适配：平板与窄屏 ---------- */
@media (max-width: 1080px) {
  .login-page { grid-template-columns: minmax(0, 1fr) minmax(340px, 0.9fr); }
  .v-copy h1 { font-size: 24px; }
}
@media (max-width: 860px) {
  body { overflow: auto; }
  .login-page { grid-template-columns: 1fr; height: auto; min-height: 100%; }
  .visual { min-height: 300px; }
  .visual-inner { padding: 22px 20px; }
  .v-stage { min-height: 220px; }
  .v-copy { max-width: none; }
  .v-copy h1 { font-size: 22px; }
  .v-points { font-size: 13px; }
  .panel-col { padding: 20px 20px 34px; }
  .panel { width: 100%; padding: 24px 20px 18px; }
}
@media (max-height: 720px) and (min-width: 861px) {
  .v-copy h1 { font-size: 22px; }
  .v-lead { margin-bottom: 12px; }
  .panel { padding: 22px 26px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .role, .submit { transition: none; }
}
