/* 登录门禁：全屏覆盖，登录成功后隐藏 */
.auth-gate {
  position: fixed;
  top: var(--titlebar-height);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: calc(100vh - var(--titlebar-height));
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #1a1a1a;
}

.auth-gate.hidden {
  display: none;
}

.auth-gate-left {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px;
  color: #fff;
  overflow: hidden;
  background: linear-gradient(to bottom right, rgba(17, 17, 17, 0.9), #111111, rgba(17, 17, 17, 0.8));
}

.auth-gate-left-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
}

.auth-gate-blur-1,
.auth-gate-blur-2 {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(64px);
}

.auth-gate-blur-1 {
  top: 25%;
  right: 25%;
  width: 256px;
  height: 256px;
  background: rgba(255, 255, 255, 0.1);
}

.auth-gate-blur-2 {
  bottom: 25%;
  left: 25%;
  width: 384px;
  height: 384px;
  background: rgba(255, 255, 255, 0.05);
}

.auth-brand {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 600;
}

.auth-brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-brand-icon svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.auth-scene-wrap {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 500px;
}

.auth-scene {
  position: relative;
  width: 550px;
  height: 400px;
}

.auth-footer-links {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 32px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
}

.auth-footer-links a,
.auth-footer-links .auth-footer-link {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
}

.auth-footer-links a:hover,
.auth-footer-links .auth-footer-link:hover {
  color: #fff;
}

.auth-gate-right {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: #fff;
}

.auth-form-wrap {
  width: 100%;
  max-width: 420px;
}

.auth-panel { display: none; }
.auth-panel.active { display: block; }

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-header h1 {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

.auth-header p {
  margin: 0;
  font-size: 14px;
  color: #6b7280;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-field label {
  font-size: 14px;
  font-weight: 500;
}

.auth-label-optional {
  font-weight: 400;
  font-size: 12px;
  color: #9ca3af;
}

.auth-field input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.auth-form-login .auth-field input { height: 48px; }

.auth-field input:focus {
  border-color: #9ca3af;
  box-shadow: 0 0 0 2px rgba(156, 163, 175, 0.35);
}

.auth-field-hint {
  margin: 0;
  font-size: 12px;
  color: #9ca3af;
}

.auth-email-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.auth-email-row input {
  flex: 1;
  min-width: 0;
}

.auth-email-row select {
  width: 118px;
  height: 44px;
  padding: 0 8px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13px;
  color: #374151;
  background: #fff;
  outline: none;
  box-sizing: border-box;
}

.auth-email-row select:focus {
  border-color: #9ca3af;
  box-shadow: 0 0 0 2px rgba(156, 163, 175, 0.35);
}

.auth-line-field {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  margin-top: -4px;
}

.auth-line-field label {
  font-size: 12px;
  font-weight: 400;
  color: #9ca3af;
  white-space: nowrap;
}

.auth-line-field select {
  width: auto;
  min-width: 96px;
  max-width: 148px;
  height: 28px;
  padding: 0 6px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 12px;
  color: #6b7280;
  background: #fff;
  outline: none;
  box-sizing: border-box;
}

.auth-line-field select:focus {
  border-color: #9ca3af;
  box-shadow: 0 0 0 2px rgba(156, 163, 175, 0.25);
}

.auth-line-field.hidden {
  display: none;
}

.auth-code-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.auth-code-row input {
  flex: 1;
  min-width: 0;
}

.auth-code-btn {
  flex-shrink: 0;
  min-width: 108px;
  height: 44px;
  padding: 0 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  color: #111827;
  font-size: 13px;
  cursor: pointer;
  box-sizing: border-box;
}

.auth-code-btn:hover:not(:disabled) {
  background: #f9fafb;
  border-color: #d1d5db;
}

.auth-code-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.auth-optional-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  color: #6b7280;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}

.auth-optional-toggle:hover {
  color: #374151;
}

.auth-optional-arrow {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.auth-optional-toggle[aria-expanded="true"] .auth-optional-arrow {
  transform: rotate(180deg);
}

.auth-optional-fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-optional-fields.hidden {
  display: none;
}

.auth-input-pwd {
  position: relative;
}

.auth-input-pwd input {
  padding-right: 40px;
}

.auth-toggle-pwd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: none;
  padding: 4px;
  cursor: pointer;
  color: #9ca3af;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-toggle-pwd:hover { color: #4b5563; }
.auth-toggle-pwd svg { width: 20px; height: 20px; }

.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
}

.auth-row-options {
  gap: 12px;
  flex-wrap: nowrap;
}

.auth-legal-agree {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 12px;
  line-height: 1.6;
  color: #9ca3af;
}

.auth-legal-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: #6b7280;
}

.auth-legal-check input {
  flex-shrink: 0;
}

.auth-legal-agree .auth-link-btn {
  font-size: 12px;
  color: #111;
  text-decoration: underline;
}

.auth-legal-sep {
  color: #9ca3af;
}

.auth-legal-tip {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  color: #9ca3af;
  text-align: center;
}

.auth-legal-tip .auth-link-btn {
  font-size: 12px;
  color: #111;
  text-decoration: underline;
}

.auth-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.auth-link-btn {
  border: none;
  background: none;
  padding: 0;
  font-size: 14px;
  color: #111;
  cursor: pointer;
  text-decoration: none;
}

.auth-link-btn:hover { text-decoration: underline; }

.auth-msg {
  padding: 12px;
  font-size: 14px;
  border-radius: 8px;
  border: 1px solid;
}

.auth-msg.hidden { display: none; }
.auth-msg.error { color: #dc2626; background: #fef2f2; border-color: #fecaca; }
.auth-msg.success { color: #16a34a; background: #f0fdf4; border-color: #bbf7d0; }

.auth-submit {
  width: 100%;
  height: 48px;
  border: none;
  border-radius: 8px;
  background: #111;
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.auth-submit:hover { background: #2b2b2b; }
.auth-submit:disabled { opacity: 0.6; cursor: not-allowed; }

.auth-switch {
  text-align: center;
  margin-top: 24px;
  font-size: 14px;
  color: #6b7280;
}

/* 角色动画 */
.char-body {
  position: absolute;
  bottom: 0;
  transform-origin: bottom center;
  transition: transform 0.7s ease-in-out, height 0.7s ease-in-out;
}

.char-eyes {
  position: absolute;
  display: flex;
  transition: left 0.7s ease-in-out, top 0.7s ease-in-out;
}

.char-eyes-fast { transition: left 0.2s ease-out, top 0.2s ease-out; }
.char-eyes.gap-8 { gap: 32px; }
.char-eyes.gap-6 { gap: 24px; }

.eyeball {
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: height 0.15s ease-out;
}

.pupil-dot {
  border-radius: 9999px;
  background-color: #2D2D2D;
  transition: transform 0.1s ease-out;
}

.app.app-locked {
  visibility: hidden;
  pointer-events: none;
}

.reconnect-gate {
  position: fixed;
  top: var(--titlebar-height);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10002;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
}

.reconnect-gate.hidden {
  display: none;
}

.reconnect-inner {
  text-align: center;
  padding: 32px 40px;
  max-width: 420px;
}

.reconnect-spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 20px;
  border: 3px solid #e5e7eb;
  border-top-color: #2D2D2D;
  border-radius: 50%;
  animation: reconnect-spin 0.9s linear infinite;
}

.reconnect-title {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 10px;
}

.reconnect-sub {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.6;
}

@keyframes reconnect-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 1023px) {
  .auth-gate { grid-template-columns: 1fr; }
  .auth-gate-left { display: none; }
}

.legal-modal {
  position: fixed;
  inset: 0;
  z-index: 10005;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.legal-modal.hidden {
  display: none;
}

.legal-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.legal-modal-panel {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: min(78vh, 640px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

.legal-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid #e5e7eb;
}

.legal-modal-header h4 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #111;
}

.legal-modal-close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: #f3f3f3;
  color: #111;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.legal-modal-close:hover {
  background: #e8e8e8;
}

.legal-modal-body {
  padding: 20px 22px 24px;
  overflow: auto;
  font-size: 14px;
  line-height: 1.75;
  color: #374151;
}

.legal-modal-body h4 {
  margin: 18px 0 8px;
  font-size: 15px;
  color: #111;
}

.legal-modal-body h4:first-child {
  margin-top: 0;
}

.legal-modal-body p,
.legal-modal-body ul {
  margin: 0 0 12px;
}

.legal-modal-body ul {
  padding-left: 20px;
}

.auth-captcha-wrap {
  margin-bottom: 14px;
}

.auth-captcha-wrap.hidden {
  display: none;
}

.auth-captcha-hint {
  margin: 0 0 8px;
  font-size: 12px;
  color: #6b7280;
  text-align: center;
}

.auth-captcha-hint.error {
  color: #b42318;
}

.auth-captcha-go {
  width: 100%;
  height: 44px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #fff;
  color: #111827;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.auth-captcha-go:hover:not(:disabled) {
  border-color: #9ca3af;
  background: #f9fafb;
}

.auth-captcha-go:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-captcha-go.verified {
  border-color: #16a34a;
  color: #166534;
  background: #f0fdf4;
}
