* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#app {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* 认证容器 */
.auth-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.auth-box {
  background: #fff;
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.logo {
  text-align: center;
  margin-bottom: 2rem;
}

.logo .icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 0.5rem;
}

.logo h1 {
  font-size: 1.5rem;
  color: #1a1a2e;
  margin-bottom: 0.25rem;
}

.logo .subtitle {
  color: #6b7280;
  font-size: 0.875rem;
}

/* 表单 */
.form-section h2 {
  font-size: 1.25rem;
  color: #1a1a2e;
  margin-bottom: 1.5rem;
  text-align: center;
}

.tabs {
  display: flex;
  background: #f3f4f6;
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 1.5rem;
}

.tab {
  flex: 1;
  padding: 0.625rem;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  color: #6b7280;
  transition: all 0.2s;
}

.tab.active {
  background: #fff;
  color: #4f46e5;
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  color: #374151;
  margin-bottom: 0.375rem;
}

.required {
  color: #ef4444;
}

.form-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 0.9375rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* 验证码 */
.captcha-group {
  margin-top: 1rem;
}

.captcha-input {
  display: flex;
  gap: 0.75rem;
}

.captcha-input input {
  flex: 1;
}

.captcha-image {
  width: 100px;
  height: 42px;
  background: #f3f4f6;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.125rem;
  font-weight: 600;
  color: #4f46e5;
  letter-spacing: 2px;
  user-select: none;
  transition: background 0.2s;
}

.captcha-image:hover {
  background: #e5e7eb;
}

/* 服务端下发的位图验证码：撑满固定尺寸容器 */
.captcha-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* 错误提示 */
.error {
  color: #ef4444;
  font-size: 0.875rem;
  margin-bottom: 1rem;
  text-align: center;
}

/* 按钮 */
.btn-primary {
  width: 100%;
  padding: 0.875rem;
  background: #4f46e5;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 0.5rem;
}

.btn-primary:hover {
  background: #4338ca;
}

.btn-primary:active {
  transform: scale(0.98);
}

/* 切换模式 */
.switch-mode {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.875rem;
  color: #6b7280;
}

.switch-mode a {
  color: #4f46e5;
  cursor: pointer;
  text-decoration: none;
}

.switch-mode a:hover {
  text-decoration: underline;
}

/* 模态框 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal {
  background: #fff;
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.modal h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.modal p {
  color: #6b7280;
  margin-bottom: 1rem;
}

.access-code {
  font-size: 2rem;
  font-weight: 700;
  color: #4f46e5;
  letter-spacing: 4px;
  padding: 1rem;
  background: #f3f4f6;
  border-radius: 8px;
  margin: 1.5rem 0;
  font-family: monospace;
}

.modal .tip {
  font-size: 0.8125rem;
  color: #9ca3af;
}

/* 页脚 */
.footer {
  padding: 1.5rem;
  text-align: center;
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.8);
}

.footer a {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

.footer .sep {
  margin: 0 0.5rem;
  opacity: 0.5;
}

/* 响应式 */
@media (max-width: 480px) {
  .auth-box {
    padding: 1.5rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .captcha-input {
    flex-direction: column;
  }

  .captcha-image {
    width: 100%;
  }
}
